IM 6.8.6.7 Q16 Mac OSX
Reference: viewtopic.php?f=1&t=23844&p=101359#p101359
Convert an 24-bit compressed TIFF to 8-bit compressed TIFF only works in special circumstances.
Test:
Create compressed tiff:
convert rose: -compress jpeg rose_cjpg.tiff
Type: TrueColor
Depth: 8-bit
Remove compression and convert to type palette, but result is still truecolor:
convert rose_cjpg.tiff -compress none -depth 8 -type palette rose_cjpg_cnone_palette.jpg
or reversing the order of -depth and -type
convert rose_cjpg.tiff -compress none -type palette -depth 8 rose_cjpg_cnone_palette.jpg
Type: TrueColor
Depth: 8-bit
Try writing to MIFF and then to TIFF, but result is depth 16:
convert rose_cjpg.tiff -compress none MIFF:- | convert - -depth 8 -type palette rose_cjpg_cnone_palette2.tiff
Type: Palette
Depth: 16-bit
Reverse -depth and -type, finally works.
convert rose_cjpg.tiff -compress none MIFF:- | convert - -type palette -depth 8 rose_cjpg_cnone_palette3.tiff
Type: Palette
Depth: 8-bit
Why does it not work without going to MIFF first?
Why does the order of -type -depth matter?
Possible bug convert 24-bit Tiff to 8-bit Tiff IM 6.8.6.7
Re: Possible bug convert 24-bit Tiff to 8-bit Tiff IM 6.8.6.
The JPEG format or TIFF with JPEG compression does not support palette images, instead you must choose one of sRGB, CMYK, or YCbCr.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Possible bug convert 24-bit Tiff to 8-bit Tiff IM 6.8.6.
magick wrote:The JPEG format or TIFF with JPEG compression does not support palette images, instead you must choose one of sRGB, CMYK, or YCbCr.
I understand that. But I included -compress none in my command to decompress the original before writing to palette. Is that not sufficient? See my commands above.
I had to write to MIFF and pipe to TIFF output, but the -type palette had be be before -density even to get that command to work, otherwise it remained 16-bit.
Should not this work to make 8-bit palette?
convert rose_cjpg.tiff -compress none -type palette -depth 8 rose_cjpg_cnone_palette.jpg
It does not force the output to be palette, but leaves it as truecolor
But this does works to make 8bit palette! (but only if -type is before -depth otherwise it leaves it 16-bit palette)
convert rose_cjpg.tiff -compress none MIFF:- | convert - -type palette -depth 8 rose_cjpg_cnone_palette3.tiff
Re: Possible bug convert 24-bit Tiff to 8-bit Tiff IM 6.8.6.
No because the output is JPEG and JPEG does not support colormaps. The proper command is:Should not this work to make 8-bit palette?
- convert rose_cjpg.tiff -compress none -type palette -depth 8 rose_cjpg_cnone_palette.jpg
- convert rose_cjpg.tiff -type palette -depth 8 -compress none rose_cjpg_cnone_palette3.tiff
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Possible bug convert 24-bit Tiff to 8-bit Tiff IM 6.8.6.
Very Embarrased by my mistype of the command -- accidentally typed .jpg rather than .tif for the output when testing and never noticed it.Magick wrote:convert rose_cjpg.tiff -type palette -depth 8 -compress none rose_cjpg_cnone_palette3.tiff
The -type palette option creates a 16-bit palette. The -depth 8 option creates an 8-bit palette. Finally, the -compress none option ensures that the TIFF image is not JPEG compressed which does not support colormapped images.
So you are correct, it does work.
Your comment above then explains why -depth 8 must come after -type palette. (It also works if you put -compress none before -type palette.)
Thanks for the clarification.
Sorry for the false alarm!