Last modified: 2006-02-27 00:50:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T7086, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 5086 - Image resize off by 1px
Image resize off by 1px
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
PC Linux
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-25 18:52 UTC by Carl Fürstenberg
Modified: 2006-02-27 00:50 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Carl Fürstenberg 2006-02-25 18:52:07 UTC
If an image is specified to be say 100px wide, the resulting image rendered is
99px wide, but scaled up to 100px in the browser, resulting in artifacts at the
left (1px) border and/or the top 1px. Example: [[Image:National Merit
Ribbon.png|100px]] resulted in
http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/National_Merit_Ribbon.png/100px-National_Merit_Ribbon.png
Comment 1 Melancholie 2006-02-25 21:27:12 UTC
At least fo me it is unclear what you mean with this. Could you make a
screenshot (attachement)
to show us those "artifacts"? Is this a Linux specific problem or do you use a
seldom web browser
that makes this problem?
Comment 2 Carl Fürstenberg 2006-02-25 21:42:48 UTC
If you look at the image, it's not 100px wide, but only 99px. The result is
http://upload.wikimedia.org/wikipedia/en/7/7e/Image_sizebug.png

You can see that the left most 1px column have a strange color. The html states:
"<img
src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/National_Merit_Ribbon.png/100px-National_Merit_Ribbon.png"
alt="" width="100" height="35" longdesc="/wiki/Image:National_Merit_Ribbon.png"
/>" indicating that the image is 100x35, but is using an image that is 99x35.
Comment 3 Melancholie 2006-02-26 20:32:40 UTC
Full width image before rendering to 99px: [[Image:National_Merit_Ribbon.png]]

Hmm, which web browser do you use? I guess your browser might cause this problem,
but I am not sure. (as I am no developer ;-)
Comment 4 Carl Fürstenberg 2006-02-26 22:37:04 UTC
I'm using firefox 1.5.0.1 on linux, but I don't think that the problem is at the
browser. As you can see I specified the image to be 100px wide, in the html it's
also specified that the image should be 100x35 pixels, but the resized image is
only 99x35 pixels. There must therefor be a bug in the image-resizing procedure.
Comment 5 Brion Vibber 2006-02-27 00:38:58 UTC
This seems to be an ImageMagick issue; it doesn't always give back the exact size we request:

$ convert -resize 100x35 National_Merit_Ribbon.png xxx.png
$ file National_Merit_Ribbon.png xxx.png 
National_Merit_Ribbon.png: PNG image data, 930 x 330, 8-bit/color RGBA, non-interlaced
xxx.png:                   PNG image data, 99 x 35, 8-bit/color RGBA, non-interlaced
Comment 6 Brion Vibber 2006-02-27 00:50:28 UTC
From documentation:

"By default, the width and height are maximum values. That is, the image is expanded or 
contracted to fit the width and height value while maintaining the aspect ratio of the image. 
Append an exclamation point to the geometry to force the image size to exactly the size you 
specify. For example, if you specify 640x480! the image width is set to 640 pixels and height 
to 480."

Looks like ImageMagick is doing different rounding from us and decides our ratio is off, so 
changes the given dimensions to fit in the box. Adding the ! to force the exact dimensions we 
give seems to work.

Fixed in CVS HEAD; note that existing thumbnails won't be rerendered immediately. I'll update 
the invalidation time to force regeneration on rendering after making some other changes for 
SVG etc.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links