Declaration
property ImageCount: integer
Description
Returns the number of pages/frames/images in the current file. Many image file formats can store multiple images, including TIFF, GIF, DICOM, DCX, ICO and cursor.
This property is valid for all file formats (i.e. returning 1 for formats that do not support multiple images). It provides generic access to file specific properties:
GIF_ImageCount,
TIFF_ImageCount,
GIF_ImageCount and
MEDIAFILE_FrameCount.
You can use
Seek to load/navigate images within the loaded file.
Note: If attached to a
TImageEnView with the
PDFViewer enabled, ImageCount will return the
PageCount | Demos\InputOutput\IEViewMulti\IEViewMulti.dpr |
// Show the number of pages in a TIFF
ImageEnView1.IO.LoadFromFile('C:\input.tif');
iPages := ImageEnView1.IO.Params.ImageCount;
ShowMessage('Page Count: ' + IntToStr(iPages));
// Print all pages of a TIFF
Printer.Title := 'TIFF Pages';
Printer.BeginDoc();
for I := 0 to ImageEnView1.IO.Params.ImageCount - 1 do
begin
ImageEnView1.IO.Params.ImageIndex := I;
ImageEnView1.IO.LoadFromFile('C:\input.tif');
ImageEnView1.IO.PrintImage();
end;
Printer.EndDoc();
// Load a GIF and save each of its pages as a BMP File
ImageEnView1.IO.LoadFromFile('C:\input.gif'); // Load first image to get value for Params.ImageCount
for I := 0 to ImageEnView1.IO.Params.ImageCount - 1 do
begin
ImageEnView1.IO.Params.ImageIndex := I;
ImageEnView1.IO.LoadFromFile('C:\input.gif');
ImageEnView1.IO.SaveToFile( format( 'D:\image_%d.bmp', [ I + 1 ]);
end;
See Also
◼IEGetFileFramesCount◼ImageIndex◼Seek