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.
Help converting tiff to 256 color indexed bmp
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help converting tiff to 256 color indexed bmp
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
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)?
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)?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help converting tiff to 256 color indexed bmp
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
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help converting tiff to 256 color indexed bmp
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.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.
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.