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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 From ImageEnView to TImage

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Temoc Posted - May 01 2012 : 07:48:56
What is the proper way to assign an image from a ImageEnView to a TImage (without save to file)?
The following assignment results in a distorted image:
Image1.Picture.Bitmap.Assign(ImageEnView1.Bitmap);

My goal is to assing the image to a TPNGImage:
aPng:=TPngImage.CreateBlank(COLOR_RGB, 8, ImageEnView1.Bitmap.Width, ImageEnView1.Bitmap.Height);
aPng.Canvas.Draw(0,0,ImageEnView1.Bitmap);

But I am getting the same distorted image in both cases.
4   L A T E S T    R E P L I E S    (Newest First)
Temoc Posted - May 01 2012 : 16:05:50
Thank you very much for your help
w2m Posted - May 01 2012 : 12:40:53
It turns out you do not have to set the pixelformat for what you are trying to do. You have to set Image1.Transparent := True and set the Image1.Bitmap.TransparentColor...

Try this:

var
iTransparentColor: TColor;
iRGB: hyiedefs.TRGB;
begin
  Image1.Transparent := True;
  Image1.Picture.Bitmap.Assign( ImageEnView1.Bitmap );
  iRGB := ImageEnView1.IEBitmap.Pixels [ 0, ImageEnView1.Bitmap.Height - 1 ];
  iTransparentColor := TRGB2TColor ( iRGB );
  Image1.Picture.Bitmap.TransparentColor := iTransparentColor ;
end;


I tested this with PNG images...

William Miller
Temoc Posted - May 01 2012 : 09:04:54
The issue seems to happen when I load PNG images which have transparent background. I load a few bmp images and it works fine.
Any idea on what I'm missing?
w2m Posted - May 01 2012 : 08:51:20
I am not sure if this will help, but try setting the pixelformat of the bitmap to pf24bit after you assign the bitmap:

Image1.Picture.Bitmap.Assign(ImageEnView1.Bitmap);
Image1.Picture.Bitmap.PixelFormat := pf24Bit;

William Miller