Referred many thumbnail generation algorithms, but many were about to crop most of the available screen area, if the image to be thumbnail'ed is not aligned with the image's aspect ratio.
Algorithm that I figured out to save more area of the original image is:
Assume the thumbnail dimension should be x':y'.
1. Load the image and get original width(w) and hieght(h).
2. Scale the image to X:Y, such that:
a. if h > w, Y = h * aspect_ratio, X=w
b. if h < w, X = w * aspect_ratio, Y=h
3. Crop the scaled image to x':y' calculating the area from center of the picture.
GdkPixbuf functions used for implementing this algorithms are:
gdk_pixbuf_new_from_file(),
gdk_pixbuf_get_width(),
gdk_pixbuf_get_height(),
gdk_pixbuf_scale_simple(),
gdk_pixbuf_new(),
gdk_pixbuf_copy_area()
iOS 18 and Apple Pencil wonkiness — replace your tip
-
When I see a bunch of people talking about a specific problem on message
boards with no clear answers, I feel obligated to write a blog post as a
public se...
1 week ago