While using gotk3 I came across this problem of resizing images to fit the container. As @diamondburned explained gdk pixbufs are statically the same size as the original image. Then if I want different sizes I will have to resize it.
I began searching for resources and i found these incredible sources:
- https://gabmus.org/posts/create_an_auto-resizing_image_widget_with_gtk3_and_python/
- https://newbedev.com/automatic-image-scaling-on-resize-with-py-gtk
- https://ubuntuforums.org/showthread.php?t=761973
- http://darmawan-salihun.blogspot.com/2013/01/image-scaling-in-gtk-3-with-cairo.html?m=1
- https://www.programcreek.com/python/example/88404/gi.repository.Gtk.Image
- https://www.programcreek.com/python/example/88404/gi.repository.Gtk.Image
- https://discourse.gnome.org/t/how-to-resize-image-in-gtk-rust/5032/3
- https://stackoverflow.com/questions/34839825/loading-the-thumbnail-inside-an-image-file-into-a-pixbuf
- https://www.spinics.net/lists/gtk/msg21847.html
- https://www.debugcn.com/en/article/30268250.html
- https://m.youtube.com/watch?v=CqGqb4fJalY
All of the following suggest using the Image object draw
and expose-....
signal hook to resize the pixelbuf and set it as the image again.