LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
LinkBack Search this Thread
Old 01-31-2007, 02:51 AM   #1
drosen
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
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,390
Blog Entries: 2

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


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


All times are GMT -5. The time now is 01:32 AM.

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