Converting EPS to GIF, loosing Transparency

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?".
stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-15T11:03:07-07:00

Is there a tick to getting transparency in GIF. I can run:

convert phone.eps phone.gif

and it creates a gif and converts transparency to white

if I do this instead:

convert phone.eps -transparent white phone.gif

it works, but I hear you can't hang you hat on that always working and we may not want white, why can't transparent stay transparent.

Is there a trick to getting these images (created in Illustrator/Photoshop) to convert with transparency.

Running: IM 6.8.9-4 q16 (64-bit) and GhostScript 9.14.

snibgo
Posts: 9399
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting EPS to GIF, loosing Transparency

Post by snibgo » 2017-09-15T11:39:55-07:00

I suggest you supply a link to your EPS.
snibgo's IM pages: im.snibgo.com

stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Re: Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-15T12:19:35-07:00


snibgo
Posts: 9399
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting EPS to GIF, loosing Transparency

Post by snibgo » 2017-09-15T12:47:28-07:00

Code: Select all

convert -colorspace sRGB phone.eps out.png
That gives me a transparent centre.
snibgo's IM pages: im.snibgo.com

stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Re: Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-15T13:17:19-07:00

Wow, I tried so many combos. I know you rendered a png, but gif works with this as well. Thanks!

User avatar
fmw42
Posts: 22101
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Converting EPS to GIF, loosing Transparency

Post by fmw42 » 2017-09-15T13:19:12-07:00

Note that GIF only supports binary transparency (on or off), while PNG supports 8-bit transparency (256 shades)

stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Re: Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-15T16:26:33-07:00

GIF is required output.

Is there a way to improve text output; it really is quite awful. If I flatten the image, text gets sharp but I lose transparency and my transparent background from the EPS turns white in the GIF.

Suggestions?

snibgo
Posts: 9399
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting EPS to GIF, loosing Transparency

Post by snibgo » 2017-09-15T16:37:33-07:00

stevenb46 wrote:Is there a way to improve text output; it really is quite awful.
We don't know what command you used, nor what result you got. How do you expect us to respond???
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 22101
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Converting EPS to GIF, loosing Transparency

Post by fmw42 » 2017-09-15T16:37:49-07:00

Use supersampling (assuming you used snibgo's command above)

Code: Select all

convert -colorspace sRGB -density 288 phone.eps -resize 25% out.png
Note 72*4=288

User avatar
GeeMack
Posts: 469
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Converting EPS to GIF, loosing Transparency

Post by GeeMack » 2017-09-15T16:41:37-07:00

stevenb46 wrote:
2017-09-15T16:26:33-07:00
Is there a way to improve text output; it really is quite awful. If I flatten the image, text gets sharp but I lose transparency and my transparent background from the EPS turns white in the GIF.
In most cases when you "-flatten" a stack of images, they will be flattened onto a canvas of the background color. In IM the default background color is white. If you want transparent areas to remain transparent you should use "-background none" before "-flatten".

GIFs can't display varying levels of transparency. Transparent is just on or off, so there won't be any anti-aliasing around text in transparent areas.

stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Re: Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-19T13:21:23-07:00

Text still does not look good. This is where I'm at right now.

convert -colorspace sRGB -density 960 -units PixelsPerInch "image.eps" -resize 10%% -weight Bolder -background none -flatten "image.gif"

Any suggestions?

snibgo
Posts: 9399
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting EPS to GIF, loosing Transparency

Post by snibgo » 2017-09-19T13:44:53-07:00

"-weight Bolder" will do nothing. "-background none -flatten" doesn't look useful either.

Without seeing your input or output, it's difficult to comment.
snibgo's IM pages: im.snibgo.com

stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Re: Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-21T10:23:40-07:00

Ok see attached, text in transparent background looks bad when conveted to GIF. Looks better without transparent background

https://www.dropbox.com/s/1yuzzwlwosvz6 ... e.eps?dl=0

Thanks much!

stevenb46
Posts: 40
Joined: 2014-08-20T08:47:18-07:00
Authentication code: 6789

Re: Converting EPS to GIF, loosing Transparency

Post by stevenb46 » 2017-09-22T09:30:31-07:00

Bump... any suggestions?

Note, as snibgo suggested I dropped, what he said.

now stands at:
convert -colorspace sRGB -density 960 -units PixelsPerInch "filename.eps" -resize 10%% "filename.gif"

Any suggestions?

User avatar
fmw42
Posts: 22101
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Converting EPS to GIF, loosing Transparency

Post by fmw42 » 2017-09-22T09:37:49-07:00

It is not possible to maintain good text quality at such low resolution (resize 10%) when outputting to GIF, since GIF only supports binary transparency. The only way would be to flatten to some background color before resizing and thus lose your transparency. If you need to good quality, you will have to save to PNG or TIF.

If you do not resize, then it may look acceptable.

Code: Select all

convert -colorspace sRGB -density 960 -units PixelsPerInch "image.eps" "image.gif"

Post Reply