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
 WIC + Alpha Channel Bug ?

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
wesleybobato Posted - Feb 11 2016 : 11:27:18
Hi Nigel.

I found a problem with ImageEn + WIC.

When I open a PNG image with WIC and Saved.
Failure of Transparency.

I used Google Picasa to Best Exemplify.

Remembering that the Saved properly, ImageEn Problem only occurs with
WIC.

Thank you very much for your attention

attach/wesleybobato/2016211112628_WIC.zip
160.09 KB

https://www.dropbox.com/s/5rxrdvirbxocwen/WIC.mp4?dl=0
20   L A T E S T    R E P L I E S    (Newest First)
wesleybobato Posted - Mar 02 2016 : 18:36:08
Hi Nigel.

Thank you very much for your reply.

Best regards
xequte Posted - Mar 02 2016 : 16:33:35
Hi Wesley

WIC loading in ImageEn is not intended as a replacement for our internal Bitmap handling. Please do not use it if you require support for alpha, meta data, etc.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 29 2016 : 17:53:46
Hi Nigel

Thank you for your attention.

Unfortunately with WIC does not work properly.
Because WIC does not respect the parameters of settings. IO

Can you check please?

Thank you very much.

ImageEnView1.IO.Params.BMP_HandleTransparency := True;
ImageEnView1.IEBitmap.WicRead( 'Bmp32_with_Alpha.bmp' , 0, ImageEnView1.IO.Params );
ImageEnView1.Update;
xequte Posted - Feb 29 2016 : 16:41:32
Hi Wesley

I have improved the documentation to make these properties more obvious.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 29 2016 : 08:38:56
Hi Nigel.

Thank you very much for your attention.
I found the correct solution by reading the Manual.

Have a wonderful Day.

ImageEn, unit iexBitmaps

TIOParams.BMP_HandleTransparency

TIOParams.BMP_HandleTransparency




Declaration

property BMP_HandleTransparency: Boolean;



Description

BMP files can have up to 32 bits per pixel. This property controls how to interpret the extra byte in the 32 bit word.
When BMP_HandleTransparency is true the extra byte is interpreted as an alpha channel, otherwise it is just ignored.

So if BMP_HandleTransparency = True the image will be displayed in ImageEn with transparency. Whereas if BMP_HandleTransparency = False the transparent color will nto be used.



Example

// if BMP_HandleTransparency = true then display with transparency
ImageENVect1.IO.Params.BMP_HandleTransparency := chkBMPHandleTransparency.Checked;
ImageENVect1.IO.LoadFromFile( FilePath );
xequte Posted - Feb 28 2016 : 22:36:04
Some example code (requires ImageEn 6.2.3 or newer):

// Assign a 32bit Bitmap with alpha channel to an ImageEnView (keeping the alpha)
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create();
  bmp.LoadFromFile( 'Bmp32_with_Alpha.bmp' );
  ImageEnView1.IEBitmap.Assign( bmp );
  ImageEnView1.IEBitmap.SynchronizeRGBA( true );
  ImageEnView1.Update();
  bmp.Free();
end;

// Create a 32bit Bitmap with alpha channel
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create();
  ImageEnView1.IEBitmap.SynchronizeRGBA( false );
  ImageEnView1.IEBitmap.CopyToTBitmap( bmp );
  bmp.SaveToFile( 'test.bmp' );
  bmp.Free();
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 23 2016 : 13:58:33
Hi Nigel.

I did a test with your suggestion with TImage.

And Worked Normally.

Thank you for your attention.

xequte Posted - Feb 23 2016 : 12:52:17
I don't think TImage.Transparent and TImageEnView.EnabledAlphaChannel are equivalent. TImage.Transparent just makes the background transparent (defined as the color of the corner pixel). At least that is how it used to be.

I have confirmed that TImage will honor the alpha channel of a BMP if I call:

Image2.Picture.Bitmap.AlphaFormat := afDefined;

At any rate, ImageEn does not yet support the alpha channel of 32bit BMP files, but I have added it to the To-do list.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 22 2016 : 16:52:13
Hi Nigel

TImage Has a property equal to ImageEn.

Thank you for your attention.

Image1.Transparent := True;
ImageEnView1.EnabledAlphaChannel := True;
xequte Posted - Feb 22 2016 : 16:42:53
Hi

I cannot get TImage to show the alpha channel of this BMP file.



procedure TForm1.Button1Click(Sender: TObject);
var
 bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  try
    bmp.LoadFromFile( 'd:\201622282427_Bmp32.bmp' );
    if bmp.PixelFormat <> pf32bit then
      ShowMessage( 'NOT 32BIT!' );
    Image2.Picture.Bitmap.Assign( bmp );
    Image2.Invalidate;
  finally
    bmp.Free;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Image2.Picture.LoadFromFile( 'd:\201622282427_Bmp32.bmp' );
  if Image2.Picture.Bitmap.PixelFormat <> pf32bit then
    ShowMessage( 'NOT 32BIT!' );
end;



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 22 2016 : 12:59:07


wesleybobato Posted - Feb 22 2016 : 07:06:19
Hi Nigel.

https://pngtobmp32.codeplex.com/



Thank you for your attention.

Best regards.

attach/wesleybobato/201622282521_Bmp32.zip
947.71 KB
xequte Posted - Feb 22 2016 : 03:05:08
Hi

Please post your source 32bit BMP file (not a PNG).

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 21 2016 : 21:44:55
Hi Nigel

I created an example and it worked Correctly.
Worked with TImage 2.

procedure TForm1.Button1Click(Sender: TObject);
var
 bmp: TBitmap;
begin
 bmp := TBitmap.Create;
  try

   if Image1.Picture.Bitmap.PixelFormat = pf32bit then
    begin
     bmp.Assign( Image1.Picture.Graphic );

     case bmp.PixelFormat of
       pfDevice: ;
       pf1bit: ;
       pf4bit: ;
       pf8bit: ;
       pf15bit: ;
       pf16bit: ;
       pf24bit: ;

       pf32bit:
        begin
         Image2.Picture.Bitmap.Assign( bmp );
         Image2.Invalidate;
       end;

       pfCustom: ;
     end;

    end;

  finally
   bmp.Free;
  end;

end;

Thank you very much for your attention.
xequte Posted - Feb 21 2016 : 20:55:52
Hi Wesley

No, it does not, and I've added that to the to-do list. But have you confirmed that TImage will even support the transparency of a 32bit TBitmap (not a PNG)?


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 21 2016 : 20:12:04
Hi Nigel

I studied the method CopyToTBitmap
At No Time This Procedure Renders AlphaChannel.

That is why I Said that This Incomplete this method.
I think.

Thank you very much for your attention.
wesleybobato Posted - Feb 21 2016 : 19:50:07
Nigel.

To answer your question.
the only problem is that ImageEn does not transfer Correctly
the Transparency.

but ImageEn manages to capture Properly the Transparency of a TImage With Transparency.

I tried everything for days but ImageEn, does not transfer the information Transparency Correctly.

Thank you for your wonderful Attention.
wesleybobato Posted - Feb 21 2016 : 19:46:08
Nigel.

My Example Image Works Perfectly
With a PNG file with PixelFormat 32bit

I believe that lack Some code in ImageEn to create a Compatibility
Correct with TImage.

Thanks Again.
xequte Posted - Feb 21 2016 : 19:35:36
Hi Wesley

Do you mean the transparency is not transferred? This is because you are assigning to the TImage has a bitmap, which means that you would need to transfer it as 32bit and I am not sure that TImage even supports
transparency of 32bit TBitmaps. Also, ImageEn does not assign the alpha channel with 32bit TBitmap.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
wesleybobato Posted - Feb 21 2016 : 16:17:53
Hi Nigel
After Many Days Test.
I found that ImageEn, does not work correctly with TImage.
When we use PNG.

I added a Project Example.

You Can Check Please
Thank you Nigel.

#Code Here
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
 //Load Picture...
 Image1.Picture.Assign( ImageEnView1.Bitmap );
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 //Assign From TImageEnView...
 ImageEnView1.IO.LoadFromFile( 'C:\Users\Wesley\Desktop\RotateAndCrop\002.png' );
end;





attach/wesleybobato/2016221161718_TImage.zip
2348.97 KB