jeewiya
jeewiya

Reputation: 571

How to covert svg, eps and ai to png in ghostscript

I have to convert svg, eps and ai files to png for show thumbnails. Following command support for ai and eps, but not working for svg. Is there are any way to convert these file formats to png using same command.

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dDEVICEWIDTHPOINTS=1440 -dDEVICEHEIGHTPOINTS=960 -r300 -dGraphicsAlphaBits=4 -sOutputFile=outputfile.jpeg inputfile.eps

Upvotes: 0

Views: 4244

Answers (1)

You should use ImageMagick and its convert utility or find some other SVG to PNG converter (perhaps inkscape used with --export-png=file --without-gui), see also this, or even spend a year studying SVG and PNG formats and writing your own converter.

ghostscript is a PostScript interpreter. It can handle .eps (this is for Encapsulated PostScript) files because they are in some variant of PostScript. Since PDF is related to PostScript, you can ask gs to output PDF. But SVG is completely unrelated to PostScript, so gs cannot process .svg files!

You cannot use gs to convert SVG files.

(Pedantically, PostScript is a Turing complete programming language and has File IO primitives, so in theory you could spend several years writing in PostScript your own SVG to PNG converter and use gsto run it. You don't want to do that)

Upvotes: 3

Related Questions