Tiff saved with metadata is corrupted

Help
Phodopus
2014-07-27
2014-07-30
  • Phodopus

    Phodopus - 2014-07-27

    Hi,
    I am trying to use FreeImage in Lazarus. When image contains metadata, this code:

    Bitmap:=TFreeWinBitmap.Create;
    Bitmap.Load('DSC_5219.tif');
    Bitmap.Save('outfile.tif');

    saves files, that I can't open, they seem to be corrupted. For example Gimp says "No space to read TIFF directory". Example file (about 17MB, saved from Nikon Capture NX2):
    http://ajotte.com/temp/DSC_5219.tif

    Above code works without problems for tiffs without metadata and for jpg with or without metadata.
    Any help? :)

     
  • Hervé Drolon

    Hervé Drolon - 2014-07-30

    Hi,

    This file contains an Exif "GPS IFD" tag located inside the TIFF IFD (where IFD stands for Image File Directory, this is an offset used to read the next entry inside the file).
    The "GPS IFD" tag SHOULD BE (MUST BE - see Exif v2.3 specification - ?) located inside the Exif IFD (and NOT inside the TIFF IFD).
    This was causing a bug when reading, then writing a TIFF containing such a misplaced IFD tag.
    This bug is fixed in the CVS (the tag is simply ignored when loading a file).

    Hervé

     
  • Phodopus

    Phodopus - 2014-07-30

    Great.
    Is there any chance for a new version soon?
    Now I am creating image without metadata and using exiftool for cloning all tags :)

    And, BTW, this is maybe for another thread, but..

    I can't create bitmap with 24 (or 48) bpp.

    This code creates bitmap with 8bpp:

    Bitmap:=TFreeWinBitmap.Create(FIT_BITMAP, dx,dy,24);

    So after this call I have to

        Bitmap.ConvertTo24Bits;
    

    or
    Bitmap.ConvertToType(FIT_RGB16,true);

    Regards,
    Andrzej

     
    Last edit: Phodopus 2014-07-30

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks