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
 TImageEnView: PasteFromClipboard & Transparency
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AScomp

Germany
17 Posts

Posted - Dec 31 2020 :  20:49:22  Show Profile  Reply
Hello,

first of all, I wish everybody a happy new year! ;-)

And here is my question: I would like to paste an image from the clipboard to a TImageEnView including transparency. Unfortunately, the image loses its transparency once pasted.


           if ImageEnViewClipboard.Proc.CanPasteFromClipboard() then begin
              ImageEnViewClipboard.EnableAlphaChannel := true;
              ImageEnViewClipboard.IEBitmap.AlphaChannel.Location := ietbitmap;
              ImageEnViewClipboard.IO.Params.Bmp_HandleTransparency := True;
              if ImageEnViewClipboard.Proc.PasteFromClipboard() then
                 ImageEnViewClipboard.IO.SaveToFilePNG('C:\Ascomp\Programme\Delphi\ImageFormer\ImgFormerV1.0\test.png');
           end;


Here the copied image in Photoshop with transparency (on the upper left side, just for demonstrating). Copied using Ctrl + C.



Here what has been generated by ImageEnViewClipboard.IO.SaveToFilePNG call (be not irritated: the picture has no transparency at the top left, but is white).



Any ideas?

Thank you in advance!

Kind regards

Andreas

xequte

38189 Posts

Posted - Jan 01 2021 :  22:31:08  Show Profile  Reply
Hi Andreas

What application are you copying from? To include the alpha channel when pasting, the source application needs to support the PNG clipboard format. The standard Windows bitmap clipboard format does not support alpha.

Also, in v9.2.6 and older you need to be pasting the whole image to ImageEn, not pasting to an existing selection. From 9.3.0, pasting to a rect will support the alpha channel.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

AScomp

Germany
17 Posts

Posted - Jan 02 2021 :  08:03:24  Show Profile  Reply
Hi Nigel,

thank you for getting back.

I tried copying with Adobe Photoshop Elements and with Windows 10 Paint, both resulted in non-transparent images.

Now I tried with GIMP and it works properly.

Would you suggest to add

ImageEnViewClipboard.IEBitmap.AlphaChannel.Location := ietbitmap;
ImageEnViewClipboard.IO.Params.Bmp_HandleTransparency := true;

Because I recognized that it works without these lines properly as well.

Thank you very much!

Kind regards

Andreas
Go to Top of Page

xequte

38189 Posts

Posted - Jan 03 2021 :  14:32:24  Show Profile  Reply
Hi Andreas

Those two options won't affect pasting. One that you will need is:

ImageEnView1.EnableAlphaChannel := True;

or

ImageEnView1.IEBitmap.AlphaChannel; // Create an alpha channel if it does not exist

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

AScomp

Germany
17 Posts

Posted - Jan 03 2021 :  14:53:32  Show Profile  Reply
Hi Nigel,

great, thank you very much for the excellent support!

Kind regards

Andreas
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: