Reputation: 3015
When I use ghostsview to convert a postscript file to tiff I use the format 72, but if I want to have the same format when using ghostscript which resolution should I use? for example
gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffg4 -r????? -sOutputFile=a.tif a.ps
It seems like it is
gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffg4 -r600 -sOutputFile=a.tif a.ps
But it isn't perfectly correct.
EDIT: What I mean is that in ghostsview, which is the gui version of ghostscript, I can set the resolution for lets say "tiffcrl" to 72, 96, 204x196 and 204x98. What I want is to get the same output that I get when setting resolution to 72 in ghostview, as when I use Ghostsript gswin32c.exe
What are the default settings in gsview so I can transfer them directly into the command line prompt so the output results will be the same?
EDIT2: The version of gsview is 4.9 and the installed version of ghostscript is 9.01, my operating system is windows 7 32bit, I only have one ghostscript edition installed.
What I do is opening a Postscript-file with gsview and then i press "Convert" under "File". After that I choose the device tiffcrle and the resolution 72. All other options anywhere are default(I haven't messed with them so to speak). The file I get when doing it this way has a resolution of 4958x7017.
When I do it with ghostscript
gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffcrle -r72 -sOutputFile=a.tif a.ps
I get a much smaller file (kb wise) with a resolution of 595x842, with a totally crappy resolution.
I've also tried the same command but using -r600 which gives me a file with the same resolution as the gsview made file, but it has a different size (kb wise).
When I try the command you provided me @pipitas:
gswin32c.exe -o nul -sDEVICE=tiffcrle -c "currentpagedevice {exch ==only ( ) print == } forall" | findstr /i resolution
I get the result
/.MarginsHWResolution [204.0 196.0]
/HWResolution [204.0 196.0]
When I've tried that resolution under -r204x196 it still won't give the same output.
Best regards!
Upvotes: 2
Views: 2521
Reputation: 90193
After seeing how you proceeded with Ghostview in order to create your TIFF output from an input PS file, I am now fully convinced that the following Ghostscript command will achieve the exact same result:
gswin32c.exe ^
-o output.tif ^
-sDEVICE=tiffcrle ^
-r72x72 ^
-g595x842 ^
input.ps
(This assumes that you did leave the default setting in Ghostsview at "Fixed Page Size".
Upvotes: 1
Reputation: 90193
By default, Ghostscript uses 72dpi resolution for all (pixel) image output devices. But it uses 720dpi for the pdfwrite
output device. These default values are applied if your commandline doesn't specify a different value, such as -r200
or -r204x196
.
To determine the overall dimension of the output page, you can use -gWWWxHHH
to specify width and height in pixels.
Ghostview is a GUI wrapper around Ghostscript, but made by a different developer/company. Ghostview uses Ghostscript internally as its interpreter and renderer. It allows you to set different -rNNxMM
resolutions through its GUI.
On Windows, there are two Ghostscript commands:
stdout
output (and also for input if in interactive mode)Both these commands accept the -rNNxMM
and -gWWWxHHH
parameters. To fully understand how they work, you should play with different variations of
gswin32.exe -rNNNxMMM -gWWWxHHH c:/path/to/file.pdf
Anyway, the short answer to your question in the headline is: The equivalent for setting resolution in Ghostview to 72 dpi, for Ghostscript is: add -r72
to the Ghostscript commandline parameters. (But this value is used for JPEG, PNG, TIFF and other image output anyway...)
You can query all the default values Ghostscript is using for a specific output device. Try it for example for tiffg4
output by running the following command:
gswin32c.exe ^
-o nul ^
-sDEVICE=tiffg4 ^
-c "currentpagedevice {exch ==only ( ) print == } forall"
Since your interest is about resolution, modify it like this on Windows:
gswin32c.exe ^
-o nul ^
-sDEVICE=tiffg4 ^
-c "currentpagedevice {exch ==only ( ) print == } forall" | findstr /i resol
and you should see this output:
/.MarginsHWResolution [72.0 72.0]
/HWResolution [72.0 72.0]
A different device such as pdfwrite
will give a different result, because it uses different defaults:
C:\> gswin32c -o nul -sDEVICE=pdfwrite -c "currentpagedevice{exch print ==}forall"|findstr/i resolution
/.MarginsHWResolution [720.0 720.0]
/MonoImageResolution 300
/GrayImageResolution 72
/HWResolution [720.0 720.0]
/ColorImageResolution 72
Upvotes: 6
Reputation: 31141
The Ghostscript switches are documented in /gs/doc you could start with Use.html.
Resolution is set with the -r switch, if you want a resolution of 72 dpi you would set -r72 Its not obvious to me what you mean by 'use the format 72', that isn't (or doesn't seem to me) a format. But your command l;ine makes it seem like you want the resolution.
Upvotes: 2