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

>>17,15

; max_width = 100
; max_height = 50
; image_width = 450
; image_height = 300
; max_ratio = max_height / max_width; max_ratio # height and width swapped
    0.5
; image_ratio = image_height / image_width; image_ratio
    ~0.66666666666666666667
; # 0.667 > 0.5 so height = max_height and width =
; max_height * image_ratio^-1
    75
; # 75 < max_width

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