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
 How to save selected layers as PNG?

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
whisper1980 Posted - Jun 18 2026 : 16:50:15
I have the need to save selected layers as an IEN object to be added to an image at a later date. I also need to display it as a PNG in a TListView. However, the way I'm attempting to do it doesn't work well. It is not trimming the PNG, and loading the IEN file loads it huge. What am I missing or am I way off base? Is creating a new TImageEnView not the way to go? I did that to isolate the selected layers and merge just those layers into both a PNG file and IEN file. Also, when I do load the IEN file to append, it adds an additional empty layer.

    var vStream := TBytesStream.Create;
    try
      ImageEnView1.LayersSaveToStream(vStream, IEN_Native_Uncompressed, True, True, true, False, nil);
      vStream.Position := 0;
      var vImageEnView := TImageEnView.Create(Self);
      try
        vImageEnView.IO.LoadFromStream(vStream);
        vStream.Position := 0;
        vImageEnView.LayersSaveMergedTo(SaveDialog1.FileName);
        vImageEnView.IO.Params.IEN_Compression := ioPNG + 10000;
        vImageEnView.IO.SaveToFileIEN(ChangeFileExt(SaveDialog1.FileName, '.ien'));
      finally
        vImageEnView.Free;
      end;
    finally
      vStream.Free;
    end;








Eric
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jun 19 2026 : 18:22:57
Nice one, Eric

Nigel
Xequte Software
www.imageen.com
whisper1980 Posted - Jun 19 2026 : 17:27:43
Well, figured it out. Made changes that work for me perfectly:

    var vStream := TBytesStream.Create;
    try
      ImageEnView1.LayersSaveToStream(vStream, IEN_Native_Uncompressed, True, True, true, False, nil);
      vStream.Position := 0;
      var vImageEnView := TImageEnView.Create(Self);
      try
        vImageEnView.IO.LoadFromStream(vStream);
        vStream.Position := 0;
        vImageEnView.LayersCropBackground();
        vImageEnView.LayersRemove(0);
        vImageEnView.LayersSaveMergedTo(SaveDialog1.FileName);
        vImageEnView.IO.Params.IEN_Compression := ioPNG + 10000;
        vImageEnView.IO.Params.IEN_StoreBackground := false;
        vImageEnView.IO.SaveToFileIEN(ChangeFileExt(SaveDialog1.FileName, '.ien'));
      finally
        vImageEnView.Free;
      end;
    finally
      vStream.Free;
    end;

Eric