ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Threshold
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Small Donkey

2 Posts

Posted - May 11 2017 :  07:50:20  Show Profile  Reply
Hello, how to convert bitmap from this



to this using Delphi


w2m

USA
1990 Posts

Posted - May 11 2017 :  08:12:24  Show Profile  Reply
Convert the image to 32-bit with transparency and save as png:
procedure TForm1.ConvertTo32Bit;
var
  iRGB: TRGB;
begin
  if Assigned(PageControl1.ActivePage) then
  begin
    ImageEnView := TImageEnView(PageControl1.ActivePage.Controls[0]);
    if Assigned(ImageEnView) then
    begin
      ImageEnView.Proc.SaveUndo('Convert to 32-Bit ' + IntToStr(ImageEnView.Proc.UndoCount));
      Undo1.Hint := ImageEnView.Proc.UndoCaptions[0];
      Undo1.Enabled := ImageEnView.Proc.CanUndo;
      ImageEnView.EnableAlphaChannel := True;
      iRGB := ImageEnView.IEBitmap.Pixels[0, ImageEnView.IEBitmap.Height - 1];
      ImageEnView.Proc.SetTransparentColors(iRGB, iRGB, 0);
      ImageEnView.BackgroundStyle := iebsChessboard;
      ImageEnView.IO.Params.BitsPerSample := 8;
      ImageEnView.IO.Params.SamplesPerPixel := 4;
      ImageEnView.IEBitmap.Modified := True;
      ImageEnView.Update;
      ImageEnMView1.SetIEBitmapEx(ImageEnMView1.SelectedImage, ImageEnView.IEBitmap);
      ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].BitsPerSample := 8;
      ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].SamplesPerPixel := 4;
      ImageEnMView1.Update;
    end;
  end;
end;



Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

Small Donkey

2 Posts

Posted - May 11 2017 :  08:22:07  Show Profile  Reply
Thank You
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: