菜单

background black instead of white for EPS->JPG

2011年07月23日 - imagemagick

Part of the problem here was that your command line order is not quite right.
See here: http://www.imagemagick.org/Usage/basics/#cmdline

When you’re using “convert -colorspace RGB input.tiff output.jpg”, then it will still work, as ImageMagick will use it like that: “convert input.tiff -colorspace RGB output.jpg” But it’s better to specify it like that (first the input image, then the options, then the output image) right at the start.
And you might generate problems when you’re using something like “convert -colorspace RGB input.eps output.jpg”, because for EPS/AI/PDF/PS files, a “-colorspace” option before the input file is something different compared to a “-colorspace” option after the input file. When used after the input file, ImageMagick will first read the image (with Ghostscript), and after that convert it to RGB. But in the other case, the “-colorspace RGB” changes the way how ImageMagick/Ghostscript reads the image. So, in your example, you’re getting transparency right at the start.

You can fix it by either leaving out “-colorspace RGB” (and of course leaving out “-transparent white”), or by adding “-background white -flatten” as last operation. But you can also fix it by changing your command line order like that for EPS files:

CODE:
convert.exe -density 300 original.eps -colorspace RGB -resize 120 -normalize -units PixelsPerInch -quality 100 original_120x120.jpg

发表评论

电子邮件地址不会被公开。 必填项已用*标注