Command style affecting application of -colorspace

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
itafroma
Posts: 2
Joined: 2011-01-08T22:33:32-07:00
Authentication code: 8675308

Command style affecting application of -colorspace

Post by itafroma »

Starting with ImageMagick 6, the command style changed to solve a bunch of problems outlined in the Basic Usage document. That document does imply that for simple operations, one should only need to move the options from before the source file to between the source and output files to convert from the "old" style to the "new" style.

However, this doesn't seem to work for the -colorspace operation. When I use the following command, I get an output file with the correct colors:

Code: Select all

convert -colorspace rgb input.pdf output.png
But when I try to use the new command style, the -colorspace operation is never applied:

Code: Select all

convert input.pdf -colorspace rgb output.png
Why does this occur?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Command style affecting application of -colorspace

Post by fmw42 »

for pdf files, you need to tell it -colorspace (and density, etc) before reading the file (as it is generally a vector format), but esp. if the file contains cmyk images

this is proper syntax for pdf and other images than need information before they are read. but most files work with the input image specified before the options.

see http://www.imagemagick.org/Usage/basics/#why and http://www.imagemagick.org/Usage/formats/#profiles
itafroma
Posts: 2
Joined: 2011-01-08T22:33:32-07:00
Authentication code: 8675308

Re: Command style affecting application of -colorspace

Post by itafroma »

Awesome, thanks for clarifying that. Wanted to make sure I wasn't missing something. :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Command style affecting application of -colorspace

Post by anthony »

You need to remember that image reading (filename given as argument) is itself a image processing operation, which some setting can effect.

-colorspace is unusual in that it is an operation which for some reason can also effect image reading.

That is a little nonsensical, but seems unavoidable, -set colorspace may make more sense.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply