Specifying output resolution in DPI

  • Karagiosis

    Karagiosis - 2007-05-09

    Is this possible: specifying resolution of PS plots generated by GRI?

    I tried to convert a GRI-generated PS plot into a 216 dpi image, using Ghostscript 8.53. The raster picture I got was 216 dpi and 8.5 inches wide, that is 1836 pixels (=216*8.5). The device width was computed from the bounding box at the end of the PS plot: 680 pt. So I could find that there was some intrinsic 'start' resolution of 80 dpi for the conversion (680pt/8.5inches = 80dpi). I observed however a problem with Ghostscript some of the raster content was truncated on the right.

    If I choose an output resolution that is a multiple of 80 (for instance 240 dpi), the output content is OK (not truncated) but the size of the image (in inches) changes and I cannot predict how much it will be.

    I don't know if this is due to a bug of Ghostscript or to a bad written PS file. In all cases, setting directly the expected resolution in the GRI-generated PS plot could maybe help to solve the problem. Is there some way to specify it in GRI language or some preference to change?

    I can send the PS plot by email if interested.
    Below, how I converted the PS plot from the command line:

    :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 the BoundingBox near the end of the PS file)

    Thanks for any help to this non pure GRI question.

    • Dan Kelley

      Dan Kelley - 2007-05-09

      Gri output is unrasterized postscript.  Elements are position to a tolerance of 1/100th of a printers point.  Expressing this tolerance as 0.03mm indicates that quite a lot of magnification would be required to expose errors in positioning.

      Every element in postscript has its own rules, and they would be too long to go into here.  If you're talking about lines, the rule is that the line is centered on these positions.  (There are some alternative rules about what happens at the *end* of lines, e.g. whether the "pen" is square or round, whether the "pen" overhangs or not, etc.  Gri lets you control these.)

      This is really a question regarding conversion of postscript to a rasterized form.  I'm not an expert on that (I very seldom do it, since I use latex for all my writing, and it works with postscript), so I'm afraid I can't help.

      Good luck.


    • Karagiosis

      Karagiosis - 2007-05-10

      Thank you Dan,
      I'll try to ask the GhostScript and PostScript forums again.

    • Kevin Neff

      Kevin Neff - 2007-10-16

      You can use ImageMagick's convert to make bitmaps out of postscript files.  The -density option is what you want.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks