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
 ImageEn fails to load a TIFF with separate planes.
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

MMihelic

Slovenia
13 Posts

Posted - Jul 17 2012 :  04:18:48  Show Profile  Reply
ImageEn will fail during decompression of a TIFF file with the specification bellow. It is unable to decompress data. I have tested the TIFF with several TIFF viewers, and none had a problem with it.
The problem with the decompression then excalates to a complete application crash due to the way ImageEn handles the error.

I have put the file in question on one of our servers: https://neosys.si/helpdesk/public_files/MM/02357.TIF

ImageWidth (1 Short): 1984
ImageLength (1 Short): 2806
BitsPerSample (3 Short): 8, 8, 8
Compression (1 Short): Deflate, as recognized by Adobe
Photometric (1 Short): RGB
FillOrder (1 Short): Lsb2Msb
StripOffsets (3 Long): 8, 1197295, 2780928
Orientation (1 Short): TopLeft
SamplesPerPixel (1 Short): 3
RowsPerStrip (1 Short): 2806
StripByteCounts (3 Long): 1197287, 1583633, 1612952
XResolution (1 Rational): 240
YResolution (1 Rational): 240
PlanarConfig (1 Short): Seperate
PageNumber (2 Short): 0, 1
Software (10 ASCII): IrfanView

fab

1310 Posts

Posted - Jul 17 2012 :  12:44:30  Show Profile  Reply
You're right, current version doesn't support this (actually out of TIFF standard) file. The unsupported combination is:
- Compression = Deflate (not standard)
- FillOrder = 2 (not standard for RGB images, as your)
- PlanarConfig = a plane for each channel

Next minor release will support it. Anyway the change is very simple: just open tiffilt.pas, locate Strips2Bitmap procedure and this code:

if TIFFVars.FillOrder = 2 then
for i:=0 to szn[c]-1 do
ReverseBitsB( pbytearray(bufn[c])[i] );

just after "szn[c] := TIFFEnv.Stream.Read(bufn[c]^, szn[c]);" and inside the for..loop.
Go to Top of Page

MMihelic

Slovenia
13 Posts

Posted - Jul 17 2012 :  22:22:38  Show Profile  Reply
Thank you. It now works correctly. I am quite impressed with the promptness of your support and reply.

--
Regards,
Matej.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: