LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Getting an image to resize to fit window in a GTK app (https://www.linuxquestions.org/questions/linux-newbie-8/getting-an-image-to-resize-to-fit-window-in-a-gtk-app-524291/)

drosen 01-31-2007 02:51 AM

Getting an image to resize to fit window in a GTK app
 
I'm trying to write a GUI for use in a robotics project that I'm working on. I'm writing the GUI using GTK (I'm completely new to this). Part of what the GUI needs to be able to do is display images taken from a webcamera mounted on the robot. I've figured out how to get GTK images to display using gtk_image_new_from_file() followed by a widget_show() command. However, this produces an image that is of a constant size (i.e., the image doesn't scale down to fit into a given window size, and it won't scale up to fill up the space allotted to it in it containing widget). How can I get this image to resize to fit into the current space allotted to it (i.e., so that if the user drags on the main window to expand it, the size of the image that I'm displaying will also increase to fill up the newly empty space)? I've checked around on the internet, and it seems that most of the tutorials are for much more advanced users who want to do all kinds of fancy image manipulation that I don't need. Any SIMPLE (or as simple as possible) explanation would be greatly appreciated. Example code snippets would be a HUGE plus :-).

theNbomr 02-01-2007 01:02 PM

I don't think GTK alone will do what you want. You haven't said what format your image is in, but there is a pretty good chance that the ImageMagick toolkit has something which can be bound into your application to do the scaling.

--- rod.


All times are GMT -5. The time now is 05:12 AM.