Report-an-Apple-bug Friday! 18

2006-04-07 00:48:00 -08:00

This bug is Preview uses its own made-up value for resolution of PostScript images. It was filed on 2006-04-07 at 00:45 PDT.

I discovered this bug when making the navigation buttons I donated to Simone Manganelli (you may recognize his1 name if you’ve been reading the comments on this blog) for switching among his stylesheets. The PNG images that I saved from Preview showed up as 32×32 in the Finder. So I had to open the EPS file in Photoshop, which is how I found out that the resolution was wrong.


Summary:

PostScript documents can specify a resolution. Preview, when converting to PDF and then to raster format, ignores that value and uses 150 dpi instead.

Steps to Reproduce:

  1. Open an Encapsulated PostScript (.eps) file containing an explicit resolution in Preview.
  2. Save as PNG or TIFF.
  3. Open the PNG or TIFF in Photoshop. (NOTE: This is incorrect. I meant to change this but forgot. See below. —PRH)
  4. Choose “Image Size”. (NOTE: This is incorrect. I meant to change this but forgot. See below. —PRH)

Expected Results:

The resolution is as stated in the EPS file.

Actual Results:

The resolution is 150 dpi in a TIFF file, or 150.0124 dpi in a PNG.

Regression:

None known.

Notes:

The Document Structuring Conventions, upon which EPS is based, provide for a resolution in the optional “Requirements” comment. For example:

%%Requirements: resolution(x,y)

Preview appears to target a specific length in real-world measurements (inches or cm). Not only does it force the resolution to 150 dpi, it also rasterizes the image at double-size (which compensates for the resolution change, but only in applications that pay attention to the DPI — which are not many, at least in the case of PNG files). This is symptomatic of Preview converting to PDF as an intermediary, as proven by using pstopdf and then saving the PDF as PNG or TIFF — it is still saved as 150 dpi, double-size.

The solution is twofold:

  1. Rasterize at 72 dpi by default. This is the default resolution of PostScript, upon which PDF is based, so it is sane to expect both PDFs and PostScript (including EPS) files to be rasterized at that resolution by default. If you really want the double-size behavior, then the DPI should be saved as 144 dpi instead.
  2. Allow the PS-to-PDF converter to accept a resolution in its PS input.

On 2006-04-07 at 01:48 PDT, I added the following information:

Oops. I meant to change the Steps to Reproduce but forgot. Here are the correct steps:

  1. Open an Encapsulated PostScript (.eps) file containing an explicit resolution in Preview.
  2. Save as PNG or TIFF.
  3. Choose “Get Info” from Preview’s Tools menu, or press ⌘I.

  1. I’m assuming that Simone Manganelli is a he. If not, sorry; no offense intended.

Technorati tags: , , .

2 Responses to “Report-an-Apple-bug Friday! 18”

  1. Simone Manganelli Says:

    Just for reference, I am a “he”, so no offense was taken. No offense would’ve been taken even if that wasn’t the case. :)

    — Simone

    P.S. I will try to stop commenting so much. :P

  2. Mac-arena the Bored Zo Says:

    I like comments. They’re how I know that people are reading. :)

Leave a Reply

Do not delete the second sentence.


Warning: Undefined array key "ntt_saved_comment_text" in /home/public/blog/wp-content/plugins/negative-turing-test/negative-turing-test.php on line 143