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
 Saving some pages of TImageEnMView to a TIFF file
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Elemental

USA
56 Posts

Posted - Dec 09 2020 :  15:29:57  Show Profile  Reply
Currently, I do not allow the user to select multiple pages in a TImageEnMView. However, I do allow them to export from page X to page Y. This process is very tine-consuming. A 70-page document takes 20 seconds. I can't find any more effective and efficient methods than these below. Here is my code:


procedure TForm1.ExportTiff(PageX, PageY: Integer; DestinationName: TFileName);
var
  TIFFHandler: TIETIFFHandler;
  PageIndex: Integer;
  StreamedPage: TMemoryStream;
begin
  TIFFHandler := TIETIFFHandler.Create();
  try
    for PageIndex := PageX to PageY do
    begin
      StreamedPage := TMemoryStream.Create();
      try
        iemvDocViewer.GetImageToStream( PageIndex, StreamedPage, ioTIFF );
        StreamedPage.Position := 0;
        TIFFHandler. InsertPageAsStream( StreamedPage, PageIndex );
      finally
        StreamedPage.Free;
      end;
    end;
    TIFFHandler.WriteFile( DestinationName );
  finally
    TIFFHandler.Free;
  end;
end;


As you can see, the image first has to be copied from memory in the component, to memory in a stream, and then from the stream to the TIFF file handler, and then from the file handler to disk. Can anyone offer anything faster? Again, I can't use any methods that include SelectedOnly as a parameter, because I only allow them to select one image.

xequte

38610 Posts

Posted - Dec 09 2020 :  16:15:31  Show Profile  Reply
Hi

I'm not sure there are quicker ways to do it, unfortunately.

If you were keeping a significant portion of images, it might be quicker to copy the entire file and then just delete the unwanted ones:

https://www.imageen.com/help/DeleteTIFFImGroup.html



Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: