2

For the last very many years I have successfully used:

convert file.jpg file.eps

Please help.

Dines Bjorner
  • 21
  • 1
  • 2

2 Answers2

1

Long story short, a bunch of security bugs were discovered in Ghostscript that allowed a malicious file containing Postscript (i.e. PDF, PS, EPS, etc.) to break out of the security sandbox and exploit your computer.

Because so many web apps are likely to blindly pass stuff to ImageMagick, they locked it down so, by default, it doesn't invoke Ghostscript anymore.

Here's an adapted version of the solution from this question which is probably what ImageMagick was using:

gs -sDEVICE=eps2write -o file.eps viewjpeg.ps -c '(file.jpg)' viewJPEG

However, I'd be careful about using it. It's sort of like running a shell script in that you need to be careful about escaping on the input.

It'd also decode and re-encode the JPEG resulting in generation loss and requiring more CPU and memory for large images.

I'd suggest using img2pdf for the initial stage and then pdftops for going from PDF to EPS. img2pdf is specifically designed to be a lossless conversion, unlike the approach ImageMagick and Ghostscript use.

This should do the trick:

img2pdf --output file.pdf file.jpg
pdftops -f 1 -l 1 -eps file.pdf file.eps 
ssokolow
  • 2,238
0

This problem has been solved by a software update, and convert file.jpg file.eps now works successfully.

You can also open the .jpg file in GIMP image editor instead. This method also worked 3 weeks ago before the recent software update. GIMP can convert .jpg files to any of its supported image formats including .eps. To install GIMP run sudo apt install gimp The Save option in GIMP saves a snapshot of the state of the file that you are working on that can be reopened to continue working on the same file later. In order to save the image itself in GIMP use either File -> Export or you can overwrite the input file with File -> Overwrite.

karel
  • 114,770
  • Not solved on a fully updated *buntu 16.04 LTS and "open it in GIMP" is both too vague to satisfy StackExchange-network rules about good-quality answers and not a suitable substitute to recommend for a batch-scriptable command. – ssokolow Feb 15 '20 at 09:39
  • OK, I admit I was a little vague. I'm more used to doing this sort of thing over on StackOverflow, where messages like "Please make your answer more complete, for example including relevant, formatted code inline" can even be triggered automatically in some cases. In this case, it'd be "For the GIMP side of your answer, please include more detail (eg. step-by-step instructions) on how to generate an .eps file using GIMP." (eg. What counts as Export vs. Save can get confusing if you're not used to it.) – ssokolow Feb 15 '20 at 10:01