Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Thumbnail Logic

Name: Anonymous 2011-12-21 7:31

Hi there /prog/

I'm currently trying to improve my image resizing algorithm.  First, I re-size the picture's height and width by 50%.  If the new width and height is > max_width and max_height, I set the thumbnail's width to max_width and the height to max_height.

Obviously this will create very poor quality thumbnails of my images.

What could I do to improve this process?

Name: Anonymous 2011-12-21 9:20

>>11
just tested your code with this
Width=450
Height=300
max_width=100
max_height=50
image_ratio=1.5
max_ratio=2

1.5<2 so
width=100
and
height=100*1.5 = 150

The new height is greater than the max_height.
doesnt work

Name: Anonymous 2011-12-21 9:26

>>15
Yea, just discovered this, swap width and height in the calculation of the ratios.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List