Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

eps to jpg

51 views
Skip to first unread message

Dieter Britz

unread,
Oct 14, 2012, 10:35:03 AM10/14/12
to
For a web page, I make pictures of graphs. I produce them
as eps files, but want them on the web page as jpg. So I
read each picture in with the gimp, and save it as jpg. This
is a bit cumbersome. So:

Is there a Linux command for the conversion, as for example
epstopdf?

Failing that, can I do all this with typed-in commands? If
so, I could put them into a shell script. It would start
with

> gimp blabla.eps

- and then?

--
Dieter Britz

John K. Herreshoff

unread,
Oct 14, 2012, 10:39:12 AM10/14/12
to
... Check out image magick... http://www.imagemagick.org/script/index.php

HTH.

John.

--
Using the Cubic at home.

Floyd L. Davidson

unread,
Oct 14, 2012, 1:32:46 PM10/14/12
to
Dieter Britz <dieterh...@gmail.com> wrote:
>For a web page, I make pictures of graphs. I produce them
>as eps files, but want them on the web page as jpg. So I
>read each picture in with the gimp, and save it as jpg. This
>is a bit cumbersome. So:

ImageMagick tools are the best way to accomplish that task, but
there are some tricks to getting good results...

This is the command line you want to use:

convert -units pixelsperinch -density 360 foo.eps \
-depth 8 -type truecolor -resize 3840 foo.jpg

The depth option is not actually necessary with conversion to a
JPEG output, but I've left it there because that command line is
generic for any output format. Change foo.jpg to foo.tif and it
produces a TIFF formatted output file.

The value for -density can be adjusted for the quality your
image requires. For example, 72 will produce very crude
results, 150 will be "draft" mode, 300 is good, and 600 ppi is
high quality. The resulting file size goes up slightly, and the
processing time is significantly increased.

--
Floyd L. Davidson <http://www.apaflo.com/>
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com

Dieter Britz

unread,
Oct 17, 2012, 10:27:50 AM10/17/12
to
On Sun, 14 Oct 2012 09:32:46 -0800, Floyd L. Davidson wrote:

> Dieter Britz <dieterh...@gmail.com> wrote:
>>For a web page, I make pictures of graphs. I produce them as eps files,
>>but want them on the web page as jpg. So I read each picture in with the
>>gimp, and save it as jpg. This is a bit cumbersome. So:
>
> ImageMagick tools are the best way to accomplish that task, but there
> are some tricks to getting good results...
>
> This is the command line you want to use:
>
> convert -units pixelsperinch -density 360 foo.eps \
> -depth 8 -type truecolor -resize 3840 foo.jpg

I did this, slightly abbreviated:

convert -units pixelsperinch -density 360 foo.eps \
-type truecolor -resize 3840 foo.jpg

and the jpg, when on the web page, is HUGE. How do I control
the size?

--
Dieter Britz

unruh

unread,
Oct 17, 2012, 11:02:51 AM10/17/12
to
Well, you told it to make a HUGE picture. 3840? 360dpi?


Floyd L. Davidson

unread,
Oct 17, 2012, 12:23:41 PM10/17/12
to
Yep, exactly! As might be imagined, the -resize option
sets the pixel dimensions of the image. It's going to
make an image that is 3840 pixels across (and the
vertical dimension will be scaled to match).

That isn't really a "huge" image, it's merely 10-2/3"
across if printed. Of course if you display it in a web
browser with a window that is 800 pixels across, it will
be HUGE.

Dieter Britz

unread,
Oct 18, 2012, 3:15:31 AM10/18/12
to
Thanks, I should have twigged.

--
Dieter Britz

Dieter Britz

unread,
Oct 19, 2012, 4:21:02 AM10/19/12
to
OK, thanks. There is one problem though. Here is a description of what I
have tried: http:/www.dieterbritz.dk/foo/

How can I do this in one step, e.g. using convert? Why does it trim?

Sorry to belabour this, and I realise this is no longer a gimp
question.
--
Dieter Britz

Floyd L. Davidson

unread,
Oct 19, 2012, 5:44:06 AM10/19/12
to
It could be a typo, but I'm betting the command lines you show on the
web page are an accurate cut and paste of the ones you tried:

convert -units pixelsperinch -density 360 sub.eps truecolor sub1.jpg

and

convert -units pixelsperinch -density 360 sub.eps truecolor -resize 400 sub2.jpg

One problem with *not* having that as "-type truecolor"
would be some parts of the image going black, just as
yours is showing up. I would expect you also get an
error message about there not being a file named
"truecolor" though...

If that is not the cause, if you can put the sub.eps
file on your web page where I can download it I can see
what I get and probably work out a way to do the right
thing in one shot.

>Sorry to belabour this, and I realise this is no longer a gimp
>question.

That's okay. This is just as good a place as any!

Dieter Britz

unread,
Oct 19, 2012, 6:12:08 AM10/19/12
to
Sorry, you were right, I had missed the -type bit. With it, it
now works fine. Thanks!

--
Dieter Britz

Floyd L. Davidson

unread,
Oct 19, 2012, 6:36:31 AM10/19/12
to
Dieter Britz <dieterh...@gmail.com> wrote:
>>>>> This is the command line you want to use:
>>>>>
>>>>> convert -units pixelsperinch -density 360 foo.eps \
>>>>> -depth 8 -type truecolor -resize 3840 foo.jpg

...

>How can I do this in one step, e.g. using convert? Why does it trim?

I played with that a bit more, and would change the above command to
this:

convert -type truecolor -units pixelsperinch -density 600 foo.eps \
-depth 8 -resize 400 foo.jpg

It makes a difference with ImageMagick tools where an option is at on the
command line. While the first example above works, it turns out that if
certain other options are added in, it won't work unless the -type option
comes before the input file.

And that becomes important... when you want to try this one on for size:

convert -type truecolor -units PixelsPerInch \
-density 1000 \ # much finer lines and text
sub.eps \
-depth 32 \ # better precision
-gamma 0.454545 \ # remove gamma correction
-resize 400 \ # now resize the image
-gamma 2.2 \ # restore gamma correction
-depth 8 \ # back to 8-bit depth
-unsharp 1.5x1+0.7+0.02 \ # sharpen tone edges
-quality 90 \
sub2.jpg

Or, without the comments:

convert -type truecolor -units PixelsPerInch -density 1000 \
sub.eps -depth 32 -gamma 0.454545 -resize 400 \
-gamma 2.2 -depth 8 -unsharp 1.5x1+0.7+0.02 \
-quality 90 sub2.jpg

This is more customized to what you are doing. Setting
the density to a relatively high value (600 or more)
results in much finer lines and text. The bit depth
gets changed to 32 and the gamma correction is removed
before the resize operation is done, and then the gamma
and bit depth are restored after the resize is finished.
That makes a significant difference in the precision
with which some images are resized. (On most images it
probably is not visible.) Then a little Unsharp Mask is
used to increase contrast at tonal edges. Depending on
your exact application you might want to use a
significantly greater amount of USM.
0 new messages