ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEn fails to load a TIFF with separate planes.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
MMihelic Posted - Jul 17 2012 : 04:18:48
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
2   L A T E S T    R E P L I E S    (Newest First)
MMihelic Posted - Jul 17 2012 : 22:22:38
Thank you. It now works correctly. I am quite impressed with the promptness of your support and reply.

--
Regards,
Matej.
fab Posted - Jul 17 2012 : 12:44:30
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.