Hello,
I'm trying to parse a multi-paged Tiff image file using the class CgTIFFFileFormat. Unfortunately when I attempt to load the tiff file using this class it reports the error 'Compression type not supported'.
If I attempt to load a single image Tiff, the CgTIFFFileFormat seems to work fine, so that's why I'm thinking the problem I'm having is because of the multiple images in a single tiff file.
I'd like to have a Smalltalk class that can load multiple images from the .tif file, so I can split them out and individually save them to a SQL server database. Does anyone know if VAST has addressed this problem? I'm definately not a .tiff file expert, and really didn't want to have to become one, so... If someone has already solved this problem, I'd really appreciate advice.
In my code example below I've commented out the multi page file.
Thanks in advance.
| path file readerClass reader image |
"path := 'C:\multipaged.tif'." <== This file doesn't work
path := 'C:\singleImage.tif'. <== This file works
(file := CfsFileDescriptor open: path oflag: 0) isCfsError
ifTrue: [^self error: 'File error' ].
readerClass := CgImageFileFormat
formatMatchingFileHandle: file
atOffset: 0
ifNone: [
file close.
^self error: 'File is not a supported type of bitmapped image' ].
image := (reader := readerClass new) loadFromFileHandle: file atOffset: 0.
reader hasErrorOccurred ifTrue: [ ^self error: 'Unable to load tiff file' ].
file close.
image isNil ifTrue: [ ^self error: reader currentErrorString ].
^image