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:11

>>8
Pseudocode ok?

image_ratio = image_width / image_height
max_ratio = max_width / max_height

if image_ratio < max_ratio
    resize image to width = max_width and height = max_width * image_ratio
else
    resize image to height = max_height and width = max_height * image_ratio^-1

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