Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-31-2007, 02:51 AM   #1
LQ Newbie
Registered: Apr 2005
Posts: 7

Rep: Reputation: 0
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 :-).
Old 02-01-2007, 01:02 PM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to resize filesystem (image file)? how to truncate the image? nikov3 Linux - General 4 06-27-2006 03:02 AM
ISO image won't fit on CD nleslie Linux - General 2 12-30-2005 10:49 AM
cd image problem. iso does not fit avimd Ubuntu 4 07-05-2005 04:28 AM
GTK window resize cecilcosta Programming 0 01-11-2005 04:16 AM
Mplayer: 704x576 image cannot fit on 800x600 display? J_Szucs Linux - Software 0 03-27-2004 07:43 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration