Bits/Sample setting for .tif file conversion/write...

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
andraspap

Bits/Sample setting for .tif file conversion/write...

Post by andraspap »

I am converting various bmp and jpg files with the command line program ‘convert’ to tif files (ImageMagick version 6.2.7). The resulting files look bad in certain viewers and perfect in others. The only issue that I can see is that the files that look bad in certain viewers have Bits/Sample value 16 and not 8. (Files that look good in all viewers are all having Bits/Sample = 8.)

Can and if yes how one can control the Bits/Sample value with the ‘convert’ program?
Eventually I would like to do the same or similar step in the C-api with MagickWriteImage (or in MagickConstituteImage), is this possible?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Add -depth 8 to your command line to produce 8-bit TIFF images.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

The TIFF image format always has problems like this. What will work for one program will not always work for another. I suggest you avoid it.

See IM Examples, Common File Formats, Summery, for details
http://www.cit.gu.edu.au/~anthony/graph ... s/#summary
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
andraspap

It worked, thank you for the prompt help.

Post by andraspap »

It worked, thank you for the prompt help.
Setting -depth 8 for 'convert' fixed some of the conversion scenarios with which I had problem. Using the api call MagickSetImageDepth(wand, 8 ) enabled our application to correctly handle all the scenarios that we have in our application.
Post Reply