Last modified: 2006-02-27 00:50:28 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
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?
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.
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 ;-)
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.
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
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.