Closed Bug 533322 Opened 16 years ago Closed 14 years ago

Image GIF with Width and Height specified in EM results in unnecessary scaling

Categories

(Firefox :: General, defect)

3.5 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: graemekidd, Unassigned)

Details

(Whiteboard: [CLOSEME 2011-2-25])

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) When an image (Only tried GIF) has its height and width specified using EM anti-aliasing (Bi-cubic?) filtering is applied to the image. The filtering is still applied even when the image is still at its original size. Taking a screen shot confirms that the image is still the same size yet right clicking on the image and going to "Properties" reports that the image has been scaled. Reproducible: Always Steps to Reproduce: 1. Create a basic XHTML 1.0 Strict page 2. Create a basic GIF image (10 pixels wide by 11 pixels high) 3. Inside the BODY tag include the image <img style="width:0.6em;height:0.65em" alt="Test" src="10by11Image.gif" /> Actual Results: A 10 by 11 pixels image is shown on the page with filtering applied to it (Looks more blurry). Yet in the properties window it says: Image Dimensions: 10px x 11px (Scaled to 10px by 10px) Expected Results: Since it’s still at its original size no filtering is needed. The properties window should also report that the image has not been scaled: Image Dimensions: 10px x 11px Since my image was white I made sure the BODY tag had a background colour of Blue so the outline of the image stood out. This meant I could easily count the pixels contained within the image. HTML in full: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Image EM test</title> </head> <body style="background-color:blue"> <img style="width:0.6em;height:0.65em" alt="Test" src="10by11Image.gif" /> </body> </html>
My understanding of em to px conversion is it depends on the body font size. So at a body font size of 12pt, 0.6 and 0.65 em convert to 10 px. Do you see the same issue at various body font sizes? (I did my conversions @ http://pxtoem.com/)
Thanks Tim, you are correct in that 0.6 and 0.65 em does get converted to 10 px. This means the Properties window was correct in displaying the scaled information: Image Dimensions: 10px x 11px (Scaled to 10px by 10px) Despite this the actual width and height of the image is still wrongly rendered as 10px by 11px. Changing the height to 0.66 em stops the properties window from reporting the image has been scaled and the images dimensions are rendered correctly. Despite this it still filters the image unnecessarily as its still at the original size. When I decided to test bigger font sizes I decided to also change the width and height used in the image style. Using EM values that are closer together meant that the aspect ratio was more likely to be maintained. Therefore I tried different font sizes with the following width and height values in the image: width:0.65em; height:0.66em I then added the font-style to the BODY tag and recorded what scaled dimensions the Properties window reported compared to how many pixels were actually shown. font-size:1em; - Not Scaled - Confirmed by Screen shot font-size:2em; - Scaled (21 px by 21 px) - Screen shot 21 px by 22 px font-size:3em; - Scaled (31 px by 32 px) - Confirmed by Screen shot font-size:4em; - Scaled (41 px by 41 px) - Screen shot 42 px by 43 px font-size:5em; - Scaled (51 px by 53 px) - Screen shot 52 px by 53 px font-size:6em; - Scaled (62 px by 63 px) - Confirmed by Screen shot font-size:7em; - Scaled (73 px by 74 px) - Confirmed by Screen shot font-size:8em; - Scaled (83 px by 84 px) - Screen shot 83 px by 85 px font-size:9em; - Scaled (94 px by 95 px) - Confirmed by Screen shot I am no mathematician but it looks like the property window is calculating the scale correctly and using http://pxtoem.com/ confirms this. On the other hand the actual rendered image seems to be losing out by a few pixels, possibly due to some loss of precision. My first thought was that it followed a pattern of 3 em but the font-size of 7em disproves, notice however that font-size of 8 em is out of a factor of two, almost to compensate for 7 em. Is this normal behaviour for loss of precision? Two points: 1. An image is filtered unnecessary when width and height are specified in EM which results in no scaling. 2. There are some discrepancies in how images are scaled on the screen using EM
Version: unspecified → 3.5 Branch
Reporter, are you still seeing this issue with Firefox 3.6.13 or later in safe mode or a fresh profile? If not, please close. These links can help you in your testing. http://support.mozilla.com/kb/Safe+Mode http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 2011-2-25]
This bug has had the CLOSEME tag for several weeks and the date in the tag is far gone. If the reporter can still see this issue, Please retest with Firefox 3.6.x or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). Then please remove the closeme tag in the whiteboard, mark the bug against the proper version and comment on the bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: