ImageEn, unit imageenio

TImageEnIO.Seek

TImageEnIO.Seek


Declaration

function Seek(Page : TIEIOSeekDestination; FileName : WideString = ''): Integer; overload;
function Seek(Page : TIEIOSeekDestination; Stream: TStream; FileFormat: TIOFileType = ioUnknown): Integer; overload;


Description

Load the specified page from the last loaded multipage file, including TIFF, GIF, AVI and other video types.
This method uses LoadFromFile to load the file (hence the file name must be provided).
Parameter Description
Page Page to load
FileName Optional file name. If empty will use the last loaded file name

Returns the loaded page index, or -1 if loading failed.

Note:
 You can abort loading by setting Aborting to true
 Using Seek() is the same as setting ImageIndex and then reloading the image
 Seek is called automatically by some methods, such as TImageEnView Buttons
 You can use OnImageSeek to control image loading behavior


Demo

Demo  Demos\InputOutput\IEViewMulti\IEViewMulti.dpr


Example

// load first page
ImageEnView1.IO.Seek(ieioSeekFirst, 'D:\multipage.tiff');

// Which is the same as:
ImageEnView1.IO.Params.ImageIndex := 0;
ImageEnView1.IO.LoadFromFile('D:\multipage.tiff');

// load next page
ImageEnView1.IO.Seek(ieioSeekNext);

// Print all pages of a TIFF
ImageEnView1.IO.LoadFromFile('C:\input.tif');
Printer.Title := 'TIFF Pages';
Printer.BeginDoc();
ImageEnView1.IO.PrintImage();
idx := 0;
while ImageEnView1.IO.Seek( ieioSeekNext ) <> idx do
begin
  ImageEnView1.IO.PrintImage();
  inc(idx);
end;
Printer.EndDoc();

// Save all pages of a TIFF as JPEG
fn := 'D:\TIFF_4pages.tiff';
io := TImageEnIO.Create(nil);
try
  idx := 0;
  io.LoadFromFile( fn );
  Repeat
    io.SaveToFileJpeg('D:\TiffOut_' + idx.ToString + '.jpg');
    inc( idx );
  Until io.Seek( ieioSeekNext, fn ) <> idx;
finally
  io.Free;
end;