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
 ImageEn saves too much stuff to PNGs

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
zerob Posted - Sep 18 2024 : 15:26:28
I loaded a PSD with some visible and some hidden layers and then i wanted to merge the visible layers and save this new image to a transparent PNG.

So i loaded the PSD and did a "ImageEnView1.LayersSaveMergedTo(aBitmap, False);".
Then i tried a aBitmap.CropAlpha(0); and saved it to a PNG, then i saw that nothing was cropped.
So i decided that i try the other crop functions, and created a TImageEnProc and attached it to the IEBitmap and there i tried AutoCrop, then i played with AlphaChannel, PixelFormat, SyncAlphaChannel and do a CropAlpha again and try a Proc.CropTransparentBorder();.
Then i added it to a second ImageEn with LayersAdd and did a Proc.CropTransparentBorder(); again and then i tried LayersAdd and a merge to this IeBitmap of that layer instead of the aBitmap and tried new cropping.
Nothing worked.
So i saved that merged PNG to a file again and loaded it with LayersAdd(...png) to try the same thing again. No cropping worked (this time with a the PNG instead of the merged layers).
So i ran it in the debugger and took a look at the loaded PNG and i got confused at the thing i saw...

In the "Alpha Channel" tab of that PNG, the RGB Channels did contain the layers that where hidden in the PSD.
It seems that ImageEn saves hidden layers as image data and just hides them with Alpha Channels.
Shouldn't these layers get pruned if i save the image to a PNG (maybe other formats also include ghost data)?
This not only makes the image larger, but also can be a security or privacy issue in some cases (when you think you've hidden things on export and they still live on forever in a PNG as data, even when you alter the PNG in Photoshop, as you never see this data in any app).

This ghost data dissapears from the Debug Visualizer, if i delete the layers instead of setting them to hidden and resave the PNG.
Can you check if this is indeed the case that all Data gets exported, or if it is a Visualizer bug?

Maybe this also caused all Cropping functions to fail (the ghost data that tells it that there is still something other than transparency). Either this, or cropping is broken since the last beta or i did something completely wrong and you can't crop that easily.

This is part of one of my demos i've sent you, i just moved the layers and did leave the hidden layers in place. (hence the ghost images).
Load this image to imageen and check the Debug Visualizer to see the "RGB Channels" in the "Alpha Channel" Tab.
On the top left there is a ghost image of the hidden layer, on the bottom left there is a white line and on the bottom right there is the real image.
Also notice how all things are just black Squares instead of only the image data. Do you save images to export formats like PNG as black squares with too much data (not only the real image data) and just do the right shape by alpha channel, or is this "RGB Channels" view just some rough blocky estimation on what is in the image? (this is from a PSD and not hand drawn in ImageEn with black blocky Layers and an AlphaChannel)

Maybe i did something wrong, but if not, can you please check this?

attach/zerob/202491815041_test.png

attach/zerob/2024918151331_VisualizerImage.png

attach/zerob/2024918151341_VisualizerAlphaRGB.png
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 20 2024 : 20:44:54
Thanks, we have a fix in our latest beta.

Nigel
Xequte Software
www.imageen.com
zerob Posted - Sep 20 2024 : 12:57:58
The demo is the lines demo that i've sent you for showing a different bug before (the cropped lines and balls).
I've created a video showing you the loading of the PSD, the moving of the layers, so the hidden layers stay at the old location, the saving to PNG and the loading of the PNG. Also i constantly show the debug visualizer showing you the images and alpha.

I created 2 new buttons for showing you the isolated code lines for the bug and the video.
Im sending you the video for it.
The merged image aswell as the saved and loaded PNG contain ghost data from hidden layers in the Debug Visualizer.
xequte Posted - Sep 18 2024 : 18:37:47
Hi

LayersCrop() did not crop here because your test.png has a small white pixel on the top-left.

I tried to reproduce the creation of your bad PNG using the following code, but it worked as expected:

  ImageEnView1.ClearAll();
  ImageEnView1.LayersImport('.\divider.psd', NOT True);
  bmp := TIEBitmap.Create;
  ImageEnView1.LayersSaveMergedTo(bmp, False);
  bmp.SaveToFile( 'D:\merged.png' );
  bmp.Free;


Can you send me a demo that creates this bad PNG?


Nigel
Xequte Software
www.imageen.com
zerob Posted - Sep 18 2024 : 16:13:23
Photoshop also isn't able to crop (Trim) transparent pixels anymore in that PNG, but as im not able to view the alpha channel in Photoshop, i don't see these things. And if i do add a layermask, the mask is all white, non black (all visible), even with the transparent part, as i didn't paint with masks.
Also trying to select that ghost data with the photoshop Magic Wand doesn't work.
Selecting the transparent area with the rectangular marquee or the lasso and then hitting delete, fixes the PNG in Photoshop and now Photoshop can crop the transparent area again. It removed the ghost data.
So that ghost data still lives on and cripples things like photoshop.

Also why does the Debug Visualizer show a white line on the bottom left? Is this also some ghost data?
zerob Posted - Sep 18 2024 : 15:38:51
Hmm, now it shows it in the browser, but i still leave the ZIP file here for you to check :-)
zerob Posted - Sep 18 2024 : 15:30:03
Hmm my browser doesn't even show the first PNG that ImageEn saved from the merged image.
Maybe the format is even broken?
I will add it again, and add it to a ZIP file so it doesn't try to handle it as a image in the forum.

attach/zerob/2024918152931_test.zip
7.88 KB