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 8:55

Divide the image's width by its height to get the aspect ratio. If this number is less than the aspect ratio of your maximum dimensions, divide 1 by it and swap width and height in the rest of this algorithm. Multiply your maximum width with this ratio to get the new height. Resize the image to the maximum height and the new width.

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