This class rasterize PDF, EPS or multi-page PostScript files to any common image format. Next by calling the GetPage function, we are converting the PDF pages to images by passing the printing resolution (DPI) and the pageNumber. Var pdf2PNG = rasterizer.GetPage(xDpi, yDpi, pageNumber); Finally we are saving the images.
Active1 year, 4 months ago
What are the parameters that I should pass? The Ghostscript version I'm using is 8.71.
Chry ChengChry Cheng
1,78555 gold badges3939 silver badges6969 bronze badges
6 Answers
Ge usb optical mouse drivers. reads my.jpg and produces foo.pdf. You will have to find where your installation installed the PostScript program Kurt Pfeifle
viewjpeg.ps .
68.3k1515 gold badges186186 silver badges285285 bronze badges
HenryHenry
As mentioned by PleaseStand, GhostScript will decode the JPEG data, resulting in generation loss, as well as performance 'ten to hundred' times worse than img2pdf.
ImageMagick (i.e.
convert ) also decodes and re-encodes the images.
Robert FlemingRobert Fleming
I've been using the same basic command line Henry gave in his answer for quite some time now in a simple Bash script, with a few tweaks.
My full script converts multiple JPEG images to a multipage PDF, using this modified command:
It is called like this:
The problem is that this command would use the same (default) page size of Ghostscript (usually Letter or A4 in portrait mode), and each JPEG image will be scaled to fit this pagewidth and/or pageheight, being placed on the lower left corner.
C# Convert Pdf To Image Without Ghostscript
My script makes each PDF page use the same page dimensions as the original JPEG for the page. For auto-discovery of the JPEG's dimensions, I use ImageMagick's
identify command:
Here is the code of the full script:
Kurt PfeifleKurt Pfeifle
68.3k1515 gold badges186186 silver badges285285 bronze badges
Ghostscript Convert Pdf To Image File
alternatively on some linux distros
convert pic1.jpg pic2.jpg out.pdf does the job with mixed results
vecvanvecvan
I have Ghostscript version 9.10, so the command with the below line DIDN'T WORKED FOR ME
/usr/local/share/ghostscript/9.02/lib/viewjpeg.ps
so I modifid the command and edited the line and insted used this, IT WORKED FOR ME
So the NEW MODIFIED COMMAND IS below:
Rahul GuptaRahul Gupta
6,15444 gold badges3939 silver badges5353 bronze badges
GhostScript is a PostScript interpreter, so it does not directly support a JPEG input, only a JPEG output. That said, it does support JPEG decompression (except for progressive JPEG).
There's a PostScript program and accompanying shell script that you can use to take advantage of this called jpeg2eps. To get a PDF, most systems have the script PleaseStandPleaseStand
pstopdf available for use, which runs each of the input files (you would use the output of the jpeg2eps script) through GhostScript.
26.6k55 gold badges5959 silver badges8989 bronze badges
Not the answer you're looking for? Browse other questions tagged ghostscript or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |