Converting from EPS to PNG clips image too much.

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
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Converting from EPS to PNG clips image too much.

Post by hiemanshu »

When I try to convert from an EPS (that I generated manually) to a PNG. The text is clipped too much at the bottom. Is there any way I can work around these? I'm attaching the two files so you can see what I'm talking about.

Source file : https://www.dropbox.com/s/izj0myr507zlbmy/Test.eps?dl=0

The image when converted to a PNG looks like : https://www.dropbox.com/s/c8f3gmzkymmeboq/Test.png?dl=0

Edit: I have tried different variables to try and get a better result out of Imagemagick. I am using ImageMagick version 6.8.9-10.

Questions I have:

1. Will converting it to a different format before converting it to a PNG help?
2. Will converting it to a much higher resolution and then to the require resolution help?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting from EPS to PNG clips image too much.

Post by snibgo »

It converts fine for me, with IM v6.9.2-5 and Ghostscript 9.15 on Windows 8.1.

What version of GS are you running?
snibgo's IM pages: im.snibgo.com
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Re: Converting from EPS to PNG clips image too much.

Post by hiemanshu »

Looks like dropbox doesn't show the file as expected. Posting it to imgur.

Image

The bottom part is cut off in the image as you can see.

I am using GS version 9.05 on Ubuntu.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting from EPS to PNG clips image too much.

Post by snibgo »

With ...

Code: Select all

convert test.eps t.png
... my result is 96x37 pixels. Yours is only 71x27. I suggest you upgrade GS.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting from EPS to PNG clips image too much.

Post by fmw42 »

Your original EPS has its anti-aliased bottom edges slightly clipped by the bottom of the image. This seems to be marginally worse in the IM 6.9.4.4. conversion using Ghostscript 9.16 (for me). But I think the issue is that your EPS image is slightly too short vertically for the text you have drawn. I suspect if you give the EPS image a slightly larger vertical dimension, so that it is not not clipping any of the anti-aliasing at the bottom, it will convert better.

I get:

Code: Select all

convert Test.eps Test1.png
identify Test.eps Test1.png
Test.eps PS 96x37 96x37+0+0 16-bit sRGB 1.15KB 0.000u 0:00.000
Test1.png PNG 96x37 96x37+0+0 8-bit sRGB 1.14KB 0.000u 0:00.009

For visual comparison, I used

Code: Select all

convert -density 288 Test.eps -background white -alpha background -flatten Test5.png
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Re: Converting from EPS to PNG clips image too much.

Post by hiemanshu »

Looks like you're right fred. I'm gonna look at the GS and how it generates the eps files. Thank you for the help snibgo and fred!
Post Reply