[fpc-pascal] FPImage and mult-page TIFF support

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Dec 7 16:34:13 CET 2016


On 2016-12-07 11:43, Mattias Gaertner wrote:
> TFPReaderTiff and TFPWriterTiff support multiple IFD using multiple
> TFPCustomImage.


I just tried with FPC 3.1.1 and it fails. The initial loading of the
TIFF file works, it correctly tells me there are 10 images (confirmed
with the Unix 'identify' command, or with The Gimp). But when I try and
load the individual images, it fails. The t.Images[i].Img as seen in the
code below is always nil.

===============================
  fs := TFileStream.Create('/tmp/multipage_tiff_example.tif', fmOpenRead);
  t := TFPReaderTiff.Create;
  t.LoadFromStream(fs, true);
  Panel1.Caption :=  'image count: ' + IntToStr(t.ImageCount);
  i := 0;
  if not assigned(t.Images[i].Img) then  // <<-- always fails
  begin
    ShowMessage('failed to load image');
    Exit;
  end;
  Image1.Picture.Assign(t.Images[i].Img);
  Image1.Invalidate;
===============================

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list