convert background cmyk and flatten

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
peegee
Posts: 6
Joined: 2008-01-15T15:22:33-07:00

convert background cmyk and flatten

Post by peegee »

sorry for my bad english, but i hope you understand what i mean:

i have an transparent image "image_ean.png" (=ean-code on transparent background) and i want to save it as an cmyk-image with a cmyk-background (50/0/0/0).

Code: Select all

convert image_ean.png -background "cmyk(50%,0%,0%,0%)" -flatten -quality 100 -colorspace CMYK image_ean_cmyk.jpg
it works on a system width IM 6.2.9, but it doesn't work on IM 6.2.4.(i get a black background)
i'm not sure, if the version is the reason, because the IM-changelog starts at version 6.3, so i couldn't check this.

have you any idea, where the problem is?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert background cmyk and flatten

Post by fmw42 »

There have been many changes to PNG format over quite some releases. See changelog http://www.imagemagick.org/script/changelog.php

I can only assume something was broken in your latter release. If you can, try upgrading to the current release.

You might try converting your transparent png to say transparent gif or tiff and then try processing that to see if it is a PNG problem or something else.

If you can post a link to your input image and your old successful output image, then others could test your problem.
peegee
Posts: 6
Joined: 2008-01-15T15:22:33-07:00

Re: convert background cmyk and flatten

Post by peegee »

i can only see the changlog starting with version 6.3.1.6. but what happend between 6.2.4. and 6.2.9.?

i will try your tip with the gif.
knows somebody an other way to get a cmyk-image (with declaration of the cmyk-background color) from a transparent png?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert background cmyk and flatten

Post by fmw42 »

This seems to work fine for me under IM 6.6.9.4 Q16 Mac OSX Tiger

Input: logo2t.png
Image


convert logo2t.png -background "cmyk(50%,0%,0%,0%)" -flatten -quality 100 -colorspace CMYK logo2t_cmyk.jpg

Image

when displayed with a viewer/browser that handles cmyk jpgs properly, I see a cyan colored background in the result, which is the RGB equivalent of cmyk(50%,0%,0%,0%).

If the above image looks dark, then your browser or viewer cannot properly handle cmyk jpgs
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert background cmyk and flatten

Post by anthony »

peegee wrote:i can only see the changlog starting with version 6.3.1.6. but what happend between 6.2.4. and 6.2.9.?
Lots of things. I have kept a copy of the change long for this reason.
Actually the ChangeLog did not list version numbers before IM v6.2.6-2, only dates, so it is a little hard how far back to go.


One patch on 2005-10-17
* Patch so ImageMagick will properly convert -fill 'cmyk(0,0,0,255)' to RGB.

However you may like to also note that ...

2006-03-06 6.2.6-4
* RGB to CMYK color conversion is now scaled properly.
an other way to get a cmyk-image (with declaration of the cmyk-background color) from a transparent png?
PNG Images do not store any CMYK or RGB colorspace reference. You can force a PNG to save CMY (or other three channel colorspace) by using -set colorspace RGB (so it does not change the stored data), but it will not save as a specific colorspace. You could save colorspace info as a separate image meta-data chunk. Not certain if it takes a color profile, but it might.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
peegee
Posts: 6
Joined: 2008-01-15T15:22:33-07:00

Re: convert background cmyk and flatten

Post by peegee »

after an IM upgrade it works.
thank you for helping me.
Post Reply