How to Save 48 Bit TIFF

I’m currently using MonkeyBread TIFF Plugin to handle TIFF images so far I’ve no issues saving 24 Bit TIFF but no clue as to saving TIFF to 48 Bit.

The codes I use are as follows

									texport.Photometric = 2
									texport.SamplesPerPixel = 3
									texport.bitspersample = 16
									call texport.writergb
									call texport.close

The TIFF file still saved as 24 Bits with a Bits Per Sample of 8 instead of 16.

WriteRGB only writes 8 bit per sample.

So it overwrites setting with 8 bit per sample and 3 samples per pixel.
If you like to use 16bit, you can of course save your own.

or use the 16bit GraphicsMagick classes:


I’m trying to keep to the same codebase otherwise there will be a lot of code changes to support 48 Bit.

This is what I have so far, in terms of coming out with an alternative WriteRGB

[code] t.PlanarConfig = 1
t.Photometric = 2
t.SamplesPerPixel = 3
t.BitsPerSample = 16
t.FillOrder = 1
t.Orientation = 1
t.ResolutionUnit = 2
dim current as new picturembs(t.pict.CopyPictureMBS)
t.height = current.height
t.width = current.width

	dim h as integer = current.height-1
	for i as integer = 0 to h
			t.scanline(i) = current.RowInFormat(i,picturembs.ImageFormatRGB)

This is my original Picture

and this is the one which came out after using the code above

(In the above, I’ve saved the file as a PNG for this post but the result looks exactly as above).

Is there anything I would need to change in my code ? It did reflect that it is a 48 Bit TIFF, just that the picture seems squashed and the color is off with some color bars on the right.


You copy 8bit image data in 16bit image and that won’t work.

Please try GMImage16MBS class.