jawadi121 / smart-lencioni-image-resizer

Automatically exported from code.google.com/p/smart-lencioni-image-resizer
GNU General Public License v3.0
0 stars 0 forks source link

Final dimension one pixel greater than requested #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. http://ian.umces.edu/imageresizer/h101/images/ian_brochure_253_thumb.jpg
2.
3.

What is the expected output? What do you see instead?
Image that is 101px high. It is 102 instead.

What version of the product are you using? On what operating system?
r77, Linux

Please provide any additional information below.

This one pixel difference may not seem terribly important and I guess is
coming from some rounding issues. The catch for me is Internet Explorer. I
use some JS to convert the title tag into a caption. Without specifically
defining the width and height attributes of the image (width="x"
height="x"), the code won't work in IE. To get around this, I set up a
simple PHP function to calculate the final width and height so that it can
be included in the image tag. The problem is that my code says that the
final height will be 101, but because it is 102, it squishes and blurs the
image. I am using ceil to round off the dimensions.

As for why 101 which may seem strange - most of the landscape oriented
images that I am using this on have a height of 101 to start with. I need
to make all the images the same height - so basically this is just to
convert the portrait ones. I tried 100, but the quality of the resulting
image is often poor when only adjusting by one pixel.

Original issue reported on code.google.com by adrianbj...@gmail.com on 26 Feb 2010 at 6:12

GoogleCodeExporter commented 9 years ago
Thanks for the report. I made some changes. Will you try r96 and confirm? You 
will need 
to empty the image cache in order to see any difference.

Original comment by joe.lencioni on 26 Feb 2010 at 10:09

GoogleCodeExporter commented 9 years ago
Yep, perfect - thanks. 

Would you like a separate Issue raised about the poor quality when resizing by 
only
one pixel? It might also be an issue for more than one too - haven't really
experimented enough. I have a feeling it might be hard to get this right, 
because it
usually shows itself most with images with lots of text.

Original comment by adrianbj...@gmail.com on 26 Feb 2010 at 10:37

GoogleCodeExporter commented 9 years ago
Yes, please add another issue for that. Thanks!

Original comment by joe.lencioni on 26 Feb 2010 at 10:40