Open Bug 333377 Opened 18 years ago Updated 2 years ago

PNG and GIF pixel aspect ratio or physical dimensions ignored

Categories

(Core :: Graphics: ImageLib, defect)

x86
All
defect

Tracking

()

People

(Reporter: sparr0, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

GIF files contain a field to specify the pixel aspect ratio of the image.  PNG files contain fields to specify the physical dimensions of the pixels in the image.  This data seems to be ignored.

On http://www.libpng.org/pub/png/pngsuite.html scroll down to "Images with non-square pixels and/or pixels with physical dimensions:" and you should see 3 small square images and one large square, but instead you see two squares and two rectangles because the physical dimensions of the rectangles' pixels are ignored.

On http://sparr.homeip.net/gifsuite/gifsuite.html (limited availability, see attached zip for gif files) there are multiple images of different pixel aspect ratios, all incorrectly rendered square.

This information is important in cases such as scanned images where a scanner has a non-square resolution.  For example, using a 2400x1200dpi scanner to scan a 1"x1" picture produces a 2400x1200 pixel image.  Without dimension or aspect ratio data this image will render as a rectangle, distorting the picture.

Reproducible: Always

Steps to Reproduce:
1. view the images
Actual Results:  
wrong aspect ratio

Expected Results:  
correct aspect ratio
This zip file contains the images displayed on my gifsuite page, which is down often.
Product: Core, Component: ImageLib?
That seems right.  It is what I would have picked, given the old interface, but the new "easy for newbies" bug submission form doesnt offer a lot of choices.  Since someone obviously chose for that system to be in place, I assume they don't want the other options chosen by submitters and I will wait for the powers that be to move the bug.
If they don't want it, they can always punt it back.

(also confirming with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060409 Firefox/3.0a1 ID:2006040906)
Status: UNCONFIRMED → NEW
Component: File Handling → ImageLib
Ever confirmed: true
Product: Firefox → Core
Version: unspecified → Trunk
Assignee: nobody → pavlov
QA Contact: file.handling
It was brought to my attention that the libpng.org page specifies dimensions in its img tags.  That should be rectified soon if the site's maintainer replies to my emails, but in the mean time the sparr.homeip.net link, although less reliable, should be considered a better example and test page.
width and height tags on <img> are required per the HTML spec.
width and height *attributes* on an img tag are not REQUIRED, they are IMPLIED, as per http://www.w3.org/TR/html4/struct/objects.html#h-13.2

In this case they are notably not desired.
Assignee: pavlov → nobody
QA Contact: imagelib
Depends on: 477209
http://www.libpng.org/pub/png/pngsuite.html has since been fixed to remove width/height tags. (See comment in the page source)

http://sparr.homeip.net/gifsuite/gifsuite.html is no longer reachable.

Switching url to the libpng site.

This is also replicated on:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0a1) Gecko/20110927 Firefox/10.0a1

13 years later, and this bug still happens on the latest version of Firefox Quantum. Tested on:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0

A specific test for the Pixel Aspect Ratio was published here. JPG files are also affected.
http://frs.badcoffee.info/PAR_AcidTest

This problem will affect not only scanned images, but also:

  • Frames grabbed from SDTV (PAR = 10:11 for NTSC, and 59:54 for PAL)
  • Images from legacy computers / video-games from the 80s: CGA, EGA, MCGA, C64, SNES, ColecoVision, MSX, etc etc
  • Frames grabbed from some high definition storage: HDV, DVCPRO HD

Without real Pixel Aspect Ratio support, those images are usually stretched to "look right" on square pixels and saved back, resulting in permanent loss of quality.

Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: