Ghostscript Installation and Configuration in Windows 7

Ghostscript Introduction:

Ghostscript is a library which is used to convert any file extension to any file extension. For eg, if you want to convert pdf to image or image to pdf we can convert easily using Ghostscript. And yes, you can also use Imagemagic to do the same task but, Compare to Imagemagic, Ghostscript executes fast and uses less file space.

Below are the results for your reference,
Using `convert` to convert from PDF to PNG, with 300 density:
it took 426 seconds and 51mb

Using `gs` to convert from PDF to PNG, with 300 density:
it took 135 seconds and  39mb disk space

Also I have achieved further time improvement by using jpeg,
Using `gs` to convert from PDF to JPEG with 300 density and 100% quality:
it took 32 seconds and 153mb disk space

Ghostscript Installation:

Download and install Ghostscript with the correct version and Operating system,
In my case, I have installed Ghostscript 9.16 for Windows (64 bit)

Ghostscript Configuration:

There are several possibilities. To list the two most frequent ones:
1.            c:\full\path\to\gswin32c.exe should always work.
2.            After a fresh installation using a standard windows installer, you may need to reboot before the updated %path% environment variable is used.
3.            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 gswin64c to start Ghostscript...

Ghostscript Usage:

Now, we are going to see how to use Ghostscript commands,

1.       GS Command to convert PDF to JPG
gswin64c -dNOPAUSE -sDEVICE=jpeg -r300 -sOutputFile=outd.jpg example.pdf



Here you will get output. Refer below image, it has generated out1.jpg and out2.jpg since PDF has only 2 pages it has been generated two image files.


Hope you enjoyed the tutorial. Please feel free to drop comments if you face any issue. Thanks!

Comments

Popular posts from this blog

Joomla - Get user id