There's an issue when resizing images where passing in a fractional width or height can cause unexpected results.

For example, when resizing and cropping a 169x161 pixel image using imageapi_image_scale_and_crop() I noticed a 1 pixel black line showing up on the bottom. I discovered that imageapi_image_resize() was being passed a fractional height of 49.99999 px rather than 50. The result was that the image was resized to 49 pixels high. Then in the crop function 1px was added back to the height.

To solve this the imageapi.module simply needs to use round() in a few more places. I've attached a patch against the 5.x-1.x-dev version.

Comments

drewish’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

really needs to go into D6 and then be back ported.

drewish’s picture

StatusFileSize
new2.5 KB

here's a D6 version that tries to be consistent in rounding and casting to integers.

dopry’s picture

Status: Needs review » Patch (to be ported)

Committed to HEAD, needs D5 port.

drewish’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev
drewish’s picture

Status: Patch (to be ported) » Fixed

I committed #396924: Backport fixes from D7 core which should help this. Please test the new 5.x-1.x-dev release and re-open this issue if the problem is still occurring.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.