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
 AppendImage(Stream) single Pages for TIFF
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Ralf

112 Posts

Posted - Jan 19 2017 :  04:26:09  Show Profile  Reply
Hallo,

i use AppendImage(Stream) to insert Images into a ImageenMView. For AppendImage(File) i found in the help a syntax to insert only the pages i want

// Append all pages of a TIFF to the current content
iPageCount := EnumTIFFIm( sFileName );
for I := 0 to iPageCount - 1 do
  ImageEnMView1.AppendImage( sFileName + IEM_Path_Index_Delimiter + IntToStr( I ));

Can i do the same when i use a Stream? Or is there a function to get every Page from a TIFF Stream Like for example GetTiffPage(MStream,idx,PageStream).

Thanks
Ralf

xequte

38182 Posts

Posted - Jan 19 2017 :  18:37:00  Show Profile  Reply
Hi Ralf

Unfortunately, only a complete TIFF file can be loaded directly into a TImageEnMView via a stream. You would need to do something like:

io := TImageEnIO.Create(nil);
totalFrames := io.ParamsFromStream( stream );
for i : 0 to totalFrames do
  if WantFrame( i ) do
  begin
    stream.Position := 0;
    io.Params.ImageIndex := i;
    io.LoadFromStream( stream );
    ImageEnMView1.AppendImage( io.IEBitmap );
  end;

Note: Completely untested

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Ralf

112 Posts

Posted - Jan 20 2017 :  03:58:43  Show Profile  Reply
Hi Nigel,

i also tried to load the complete Multipage Tiff at once. The Result was that only one Page was loaded. Hier what i tried. Normale the Screen is not a file on Disk it comes from Database.

MStream:=TMemoryStream.create;
MStream.Position:=0;
MStream.LoadFromFile('c:\temp\tiff 2 pages.tif');
ImageEnMView.AppendImage(MStream);
MStream.Free;

I want to give the customer the posibility to load more than one Tiff or other image in an ImageEnMView.

I try your example and give a feedback.

Thanks
Ralf
Go to Top of Page

Ralf

112 Posts

Posted - Jan 20 2017 :  04:43:36  Show Profile  Reply
Hi Nigel,

your Idear is working with one correction:


io := TImageEnIO.Create(nil);
if io.ParamsFromStream( stream ) then
begin
  totalFrames:=io.params.imagecount;
  for i : 0 to totalFrames do
    if WantFrame( i ) do
    begin
      stream.Position := 0;
      io.Params.ImageIndex := i;
      io.LoadFromStream( stream );
      ImageEnMView1.AppendImage( io.IEBitmap );
    end;
...

Thanks
Best regards

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