Why does this generate an inverted image?
Posted: 2019-01-14T14:13:15-07:00
For this example, I am just using the built-in "rose:" data, but I see equivalent problems when using actual images. I am trying to separate the CMYK channels, do some processing on them, and then combine them back into a TIFF. When I run the below, the resulting TIFF images have all their colors inverted:
If I change in that last line to it generates a correct looking image. I am just looking to understand WHY this is the case, so I can figure out when I need to negate and when I do not, as I will eventually be running my imagemagick process on around 16MM images (consuming roughly 1.5PB of disk), and I don't want to run it twice.
Code: Select all
#!/bin/bash
convert -geometry 1000x1000 rose: -colorspace cmyk -channel C -separate rose_c.tiff
convert -geometry 1000x1000 rose: -colorspace cmyk -channel M -separate rose_m.tiff
convert -geometry 1000x1000 rose: -colorspace cmyk -channel Y -separate rose_y.tiff
convert -geometry 1000x1000 rose: -colorspace cmyk -channel K -separate rose_k.tiff
convert -channel C rose_c.tiff -channel M rose_m.tiff -channel Y rose_y.tiff -channel K rose_k.tiff -combine rose.tiff
Code: Select all
rose.tiff
Code: Select all
TIFF:- | convert - -negate rose.tiff