Page 1 of 1

Help converting tiff to 256 color indexed bmp

Posted: 2011-05-12T16:32:42-07:00
by Petti
I am trying to use the MagickWand API to read a tiff and output a bmp representing a 256 indexed color(PseudoClass) greyscale image of the Cyan channel. Please help, I have tried:

MagickSetImageType TrueColorType
MagickSeparateImageDepth 8
MagickSeparateImageChannel CyanChannel
MagickQuantizeImages (magick_wand, 256, CMYKColorspace, 0, 0, 0)

This is not getting me what I want, it only produces a "Colormap: 16" where as I need a 256 indexed colormap.

Re: Help converting tiff to 256 color indexed bmp

Posted: 2011-05-12T18:16:11-07:00
by fmw42
I don't know MagickWand API, but in command line, what you would do would be, first separate your channel, then set the depth to 8, then specify the type as either palette or grayscale, then write the output as bmp

Re: Help converting tiff to 256 color indexed bmp

Posted: 2011-05-13T08:55:23-07:00
by Petti
Ok I tried the order that you mentioned fwm42...

MagickSeparateImageChannel (CyanChannel) - "first separate your channel"
MagickSetImageDepth (8) - "then set the depth to 8"
MagickSetImageType (PaletteType) - "then specify the type as either palette or grayscale"

This produced a colortable with only 16 colors, but I need it to produce a colortable with 256 colors. Any ideas? Is there any reason that even though I set the depth for 8 bits, it would give me less colors (16) than the full 8 bits (256)?

Re: Help converting tiff to 256 color indexed bmp

Posted: 2011-05-13T09:59:38-07:00
by fmw42
Petti wrote:Ok I tried the order that you mentioned fwm42...

MagickSeparateImageChannel (CyanChannel) - "first separate your channel"
MagickSetImageDepth (8) - "then set the depth to 8"
MagickSetImageType (PaletteType) - "then specify the type as either palette or grayscale"

This produced a colortable with only 16 colors, but I need it to produce a colortable with 256 colors. Any ideas? Is there any reason that even though I set the depth for 8 bits, it would give me less colors (16) than the full 8 bits (256)?

It worked fine for me in command line mode. The only thing I can say is that perhaps your input image cyan channel has fewer colors that 256.

Can you post a link to your image and I will test in command line mode?

Re: Help converting tiff to 256 color indexed bmp

Posted: 2011-05-13T11:02:18-07:00
by Petti
Ok I looked into the image a bit more and I found that there were fewer than 256 colors in the original image, when I used a different image that I knew had 256 colors, it worked! Thanks so much for your help, I am almost complete. I have converted the C, M, and Y, but I am having trouble with Black (K). Is there something special that needs to be done for the Black Channel. The image that is produced is not Grayscale, should I use PaletteType? I need a 256 colortable Black Channel PseudoColor file.

Re: Help converting tiff to 256 color indexed bmp

Posted: 2011-05-13T11:25:51-07:00
by fmw42
Petti wrote:Ok I looked into the image a bit more and I found that there were fewer than 256 colors in the original image, when I used a different image that I knew had 256 colors, it worked! Thanks so much for your help, I am almost complete. I have converted the C, M, and Y, but I am having trouble with Black (K). Is there something special that needs to be done for the Black Channel. The image that is produced is not Grayscale, should I use PaletteType? I need a 256 colortable Black Channel PseudoColor file.
I do not have much experience with cmyk, but the same command should work. However, the black channel may have fewer colors that 256, so check that. You can try -type palette.

It might be best if you still have trouble to post a link to a sample image so others can see what is going on.