Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Ghostscript to convert JPEG to PDF

Tags:

ghostscript

What are the parameters that I should pass? The Ghostscript version I'm using is 8.71.

like image 297
Chry Cheng Avatar asked Nov 26 '10 07:11

Chry Cheng


People also ask

What is Ghostscript PDF?

Ghostscript is an interpreter for the PostScript® language and PDF files. It is available under either the GNU GPL Affero license or licensed for commercial use from Artifex Software, Inc. It has been under active development for over 30 years and has been ported to several different systems during this time.

Can Ghostscript edit PDF?

This paper intends to introduce some of the ways the Ghostscript tools can be used to manipulate a PDF file, including creation of bookmarks, annotations, and setting document properties.

How do I use Ghostscript on Windows?

Open a cmd window and (assuming your Ghostscript installation ended up in c:\path\to\gs ...) then type set path=c:\path\to\gs\gs9. 02\bin;%path% . From this same cmd window you can now simply use gswin32c to start Ghostscript (use gswin64c on 64 bit Windows)...

How do I save a JPE file as a PDF?

If you use Windows 10, open the JPG file and give the Print command i.e. Ctrl + P. In the Printer Settings, select Microsoft Print to PDF. Check the photo size and fit you want for the PDF > click Print. On the next page, enter the file name > select the location where you'll like to save the file > hit save.


1 Answers

https://gitlab.mister-muffin.de/josch/img2pdf

As mentioned by PleaseStand, GhostScript (edit: prior to v9.23) will decode the JPEG data, resulting in generation loss, as well as performance "ten to hundred" times worse than img2pdf.

Edit: Ghostscript 9.23 (2018-03-21) added a "JPEG Passthrough" capability that resolves the generation-loss/performance issue.

ImageMagick (i.e. convert) also decodes and re-encodes the images.

like image 137
Robert Fleming Avatar answered Oct 02 '22 11:10

Robert Fleming