Page 1 of 1
newbie - batch convert .eps line drawings to best format
Posted: 2011-01-12T16:52:16-07:00
by rtayek
hi, i have a bunch of .eps files that are line drawings (black and white). i am trying to figure out how to convert batches of them to a web data format (.gif, .png, .jpeg). these images will go into ebooks for ereaders and smart phones.
i can batch convert these files to these data formats using the mogrify command. but the results are not very good (lots of gray in .png format, varying line thickness in jpeg format, and a black background in .gif format).
using gimp, i discovered that when importing using the defaults (color) there was some alpha channel. flattening fixed this. importing as black and white and then just saving produced fairly good results. i have some examples (from gimp) at:
http://tayek.com/bobt/epsimages/. the .gif and the .png seem to be the best. the .jpeg is gray and i assume that is because jpeg is a color format.
the gif files seems to be the smallest, so i am leaning in that direction.
can anyone give me an incantation that would let me specify the black and white colors when doing the mogrify (or perhaps there is a better command?).
any pointers will be appreciated.
thanks
Re: newbie - batch convert .eps line drawings to best format
Posted: 2011-01-12T17:56:47-07:00
by fmw42
try
mogrify -alpha off -colorspace gray -colors 2 -depth 1 -path /fullpath2anotherdirectory -format gif *.eps
but look at the mogrify docs for -path so you can save the results to another directory so you don't walk over your originals
see
http://www.imagemagick.org/Usage/basics/#mogrify
I would try a few images manually using convert to test the commands and fine tune your -colors value and your -depth value before using mogrify
If you want to flatten rather than turning alpha off, then you need to specify a -background color and add -flatten after the -depth
Please experiment with convert before using mogrify
Re: newbie - batch convert .eps line drawings to best format
Posted: 2011-01-13T16:37:59-07:00
by anthony
-flatten will NOT work with morgify, as it is a multiple image or image sequence operator
use
-bordercolor and
-border 0 which will also 'flatten' images with mogrify.
see Removing Alpha Transparency
http://www.imagemagick.org/Usage/basics/#alpha_remove
Re: newbie - batch convert .eps line drawings to best format
Posted: 2011-01-17T22:43:05-07:00
by rtayek
i tried convert using all combinations of
def csg="-colorspace gray"
def c2="-colors 2"
def bw="-background white"
def d1="-depth 1"
def fl="-flatten"
def ao="-alpha off"
def dt=" +dither"
you can see the results here:
http://tayek.com/bobt/images/gif.html.
nothing seems to come close to what gimp does when importing in black and white.
thanks
Re: newbie - batch convert .eps line drawings to best format
Posted: 2011-01-17T22:54:02-07:00
by anthony
The question is more. how nice do you want the results?
Direct conversion of EPS is not particularly nice. You can improve things by converting it at a higher resolution then resizing.
Examples of this and for setting/changing background nicely is
http://www.imagemagick.org/Usage/text/#postscript
The greys can be important to generate a smooth looking 'anti-aliased' output.
ASIDE: Are you setting up a 'Go' site? I haven't played the game for a while but I do have a little bit on my personal website. The Game displayed is actually one that terminated as me and the other player lost interest. The game was played by email and often took months to finished a single game. PS: I was white!
http://www.ict.griffith.edu.au/anthony/ ... ibrary/go/
Re: newbie - batch convert .eps line drawings to best format
Posted: 2011-01-19T17:59:37-07:00
by rtayek
> The question is more. how nice do you want the results?
i would like them to be at least as good as gimp does, which is the first pic at
http://tayek.com/bobt/images/gif.html.
> Direct conversion of EPS is not particularly nice. You can improve things by converting it at a higher resolution then resizing.
yes, i have done that and gotten some improvements.
> Examples of this and for setting/changing background nicely is
>
http://www.imagemagick.org/Usage/text/#postscript
thanks for the link
> ASIDE: Are you setting up a 'Go' site? ...
no, a friend is translating go material from japanese and producing some ebooks - i am doing the technical stuff.
thanks
Re: newbie - batch convert .eps line drawings to best format
Posted: 2011-01-19T18:53:20-07:00
by anthony
Then reading at a higher density and resize to preserve the anti-alias information is what you need.
Study the link given, and let us know how you go.