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
 Multipage file and layers

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

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


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
graph_man Posted - Oct 30 2023 : 14:48:58

Is it possible to add layers to each page of a multi-page TIFF file and save it to a file so that after opening it will be possible to edit the layers on each page?
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 01 2023 : 15:29:58
Right, well as mentioned, there are not really any good ways to do this because of the lack of multi-frame layer formats.

At simplest you could do it by streaming:

// Save the layers of three TImageEnViews to a file
  fs: TFileStream;
  fs := TFileStream.Create(FileName, fmCreate);
  ImageEnView1.IO.SaveToStreamIEN( fs );
  ImageEnView2.IO.SaveToStreamIEN( fs );
  ImageEnView3.IO.SaveToStreamIEN( fs );

// Load the layers
  fs: TFileStream;
  fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite );
  ImageEnView1.IO.LoadFromStreamIEN( fs );
  ImageEnView2.IO.LoadFromStreamIEN( fs );
  ImageEnView3.IO.LoadFromStreamIEN( fs );

But obviously that is not a very practical solution.

Another way would be to save the files to temporary IEN files and then build a single file stream from all of them. Then when loading you could iterate through the stream until you find the image index you are looking for (which would be slow with large files). Also not a great solution.

If you are certain you want to go down this route, you should store each image+layers as IEN prefixed with its size (and maybe other metadata), so when loading you could skip ahead to the image you are looking for. This way you could also replace/insert new images.

[Image 0 Stream Size]
[Image 0 Stream]
[Image 1 Stream Size]
[Image 1 Stream]
[Image 2 Stream Size]
[Image 2 Stream]

However that would be a much more complex undertaking.

Xequte Software
graph_man Posted - Nov 01 2023 : 04:04:20
You did not understand me.
I don't want to save the layers in a separate file.
I need to save the layers in the same file as the main image.
xequte Posted - Oct 31 2023 : 22:58:11
If you want to save the layers of an image without the background image itself (to a file or stream), use:

Xequte Software
graph_man Posted - Oct 31 2023 : 17:40:57
How to save layers in each page separately?
xequte Posted - Oct 31 2023 : 17:36:59

Not easily. There is no layer support in multi-image formats. You would need to create your own frankenformat by streaming each TIFF page with its layers to a filestream (which would not be compatible with any application other than yours).

Xequte Software