I have been using Christian’s excellent TIFFPictureMBS and I could get away with just using the following statement to open the TIFF file
t = new TIFFPictureMBS
call t.open(f)
…
to handle my needs.
I just received an email from a customer who tried to open a huge TIFF 1 bit file which is like 9888 x 13992 pixels and apparently the above code didn’t work. Ended up not being able to load the file. I tried Preview app and it very fast.
I saw a Huge TIFF example on Monkeybread which reads
[quote] dim f as FolderItem
dim t as TiffPictureMBS
dim p as PictureMBS
f=SpecialFolder.Desktop.Child(“test.tif”)
if f<>Nil then
t=new TiffPictureMBS
if t.Open(f) then
dim row as MemoryBlock
dim h as integer=t.Height-1
for i as integer=0 to h
row=t.Scanline(i)
next
t.Close
MsgBox "Read TIFF file."
end if
end if[/quote]
Looks good but how do I adapt this code to convert the TIFF to a PictureMBS ? I am pretty rusty when it comes to Memoryblock. I saw the Dim statement for P but nothing in the code seems to convert that to the picture.
Nope, it doesn’t with that particular TIFF file. Basically, it didn’t load as the dimensions came back as 0 or Nil. But when I manually resized the same images to under 4000 pixels for both its width and height in Preview, it loads after that. I am not sure what maximum dimension, it supports up to.
One more thought: You say that it works after re-sizing and saving from Preview. What happens if you simply re-save the file from Preview WITHOUT resizing?
This would server to indicate if it’s pixel dimension(s) or something about how this particular file is written.
I’ve given the file another look and the original file uses LZW compression and the Color Depth reported as 1 Bit. If I duplicate the file, it still shows the same.
However when resizing the file and saving it, it still uses LZW but the depth is now 8.
Okay, I just did an experiment and resized the file down by 2 pixels and saved it in Preview which converted it to a 8 Bit TIFF LZW. This time the file opens. So it is possible that the 1 Bit handling might be the issue. This is giving me something to look into.