EPS with alpha resized -> JPEG, gets black background

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
deniel

EPS with alpha resized -> JPEG, gets black background

Post by deniel »

Hi, i have configured ghostscript in delegates.xml to use pngalpha device for all ps files. It works ok when i save to png, bmp, jpg (png is transparent, bmp, jpg have white background) but when i add -resize to the convert command i get black background in the bmp and jpeg files.

convert -verbose rhythm_in_yellow.ps rhythm.jpg -> OK
convert -verbose -density 72 rhythm_in_yellow.ps -resize 1000 rhythm.jpg -> black background

convert -verbose -density 72 rhythm_in_yellow.ps -background white -flatten -resize 1000 rhythm.jpg -> OK

the file i'm testing with is http://rhythm.bg/logo/rhythm_in_yellow.eps

I'm using 6.3.3 and 6.3.4 q16.

Thanks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: EPS with alpha resized -> JPEG, gets black background

Post by magick »

Try this command:
  • convert -verbose -colorspace rgb -density 72 rhythm_in_yellow.ps -resize 1000 rhythm.jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: EPS with alpha resized -> JPEG, gets black background

Post by anthony »

If you image has alpha, the resize will produce balck backgroudn as JPEG does not save alpha or transparency!

-flatten the image onto a -background color before saving to JPEG.
See http://www.imagemagick.org/Usage/formats/#jpg_trans
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
deniel

Re: EPS with alpha resized -> JPEG, gets black background

Post by deniel »

magick wrote:Try this command:
  • convert -verbose -colorspace rgb -density 72 rhythm_in_yellow.ps -resize 1000 rhythm.jpg
No that didn't work for me. I solved my problems with the flatten and background solution. But the other problem is that it's not interpolated right when not using flatten and background.

convert -verbose -colorspace rgb -density 72 rhythm_in_yellow.ps -resize 1000 -interpolate bilinear rhythm_3.png

Image

Thank you both for the help.
Post Reply