Karagiosis - 2007-05-05

Hi,

I have been stumbling for many hours with a GhostScript PS to TIFF conversion problem. My face probably passed by all colors in the last hours...

Can someone tell me if this is a GhostScript bug or if I am mistaken?

I use Ghostscript to convert a PS plot into TIFF format with wanted resolution about 200dpi:

:C:/blabla/gswin32.exe -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=tiff24nc -r216 -dDEVICEWIDTHPOINTS=680 -dDEVICEHEIGHTPOINTS=458 -sOutputFile="C:\outfolder\outputFile.tiff" -f "C:\infolder\inputFile.ps"

-dDEVICEWIDTHPOINTS and -dDEVICEHEIGHT are set using urx and ury from a BoundingBox near the end of the PS file.

The plot width (680) in the PS file corresponds to a resolution of 80 dpi. Don't ask me why, I don't know. I just observed that 680/80 = 8.5 inches.
And the output TIFF image was 8.5 inches wide too, that is 216 * 8.5 = 1836 pixels.

OK. Until now, all is fine. I take the 80 dpi input resolution as a fact and accept it.

But unfortunately the image truncates some of my plot on the right.

Setting the resolution to any multiple of 80 (e.g. 240) solves the problem: the output image is not more truncated and displays the same content as the PS plot.
But a new problem is created: it is not anymore possible to compute the plot width like before.
The deviceWidth/80 ratio does not give the same number of inches that the TIFF output raster at computed print size (using DPI).
(So, Is the 'start' resolution no more 80?) Do I make something wrong or is this a Ghostscript bug?

This is a real problem for me as I need to know the image size in inches so that I can georeference it. I have all necessary informations to georeference the image. I just need what its size will be after the conversion and I don't want to use additonal software to know the outputed image size.
It should be possible to know it from the device width and height if this is set from the bounding box. No?