1
votes

I have a png image with transparent background and i tried to convert that to an eps file using convert command of imagemagick,and got eps image with white background.

I want eps image with transparent background.I have a php application for designing images for tshirt printing,So image transparency is must. Also image quality of output eps image is pretty bad and image size is really big comparing to input size.

I had tried command

convert test2.png -resize 1024x1024 -density 500 -units pixelsperinch -quality 100 -compress none -alpha set -flatten -background none -depth 20 test2_eps.eps

Iam using system function of php to execute this command.

Is there any option to maintain transparency of input image? Is it white by default? How can we improve output eps image quality?

1

1 Answers

2
votes

PostScript (and therefore EPS) doesn't have a concept of transparency (with some exceptions), so you can't readily convert an image with an alpha channel to an EPS.

If the 'background' is 100% transparent it is possible to create a similar effect in PostScript using masked images (that's 2 images, where the second is a mask that determines where the 1st image draws). That's a rarely used feature, and requires a level 3 PostScript interpreter. Most EPS export functionality doesn't go above level 2.

As to whether ImageMagick can create such an EPS, I have no clue, but I wouldn't be at all surprised to find it cannot. You may have to use something like Photoshop.

Regarding the image size; PNG is a compressed format, and you have specified

-compress none

So its hardly surprising that the output is larger!

Its essentially impossible to comment on your quality problem, partly because you haven't really said exactly what it is that you see as a problem. 'Quality' is rather vague, perhaps you could post an example.

If your EPS has a thumbnail preview do not be fooled into thinking this is what the EPS contains, its a low resolution bitmap preview only and its there for the benefit of EPS consumers that can't interpret the PostScript content. So that they can preview the result when you place the EPS in the final document.