Solved

I want to display an image...

Posted on 2004-09-07
11
280 Views
Last Modified: 2010-04-22
Hello guys,

I want to display an Image, command line, on my root window, on a certain place, scaled to a certain width and height. The application should stop after displaying it and the image should stay there on the root window.
I used xv, but I get into trouble. You can display an image on your root window, but when you do, it ignores your geometry and uses the rmode parameter which forces you into tiling or centering or.. but not what I want.

I need this to draw an initial background on the start of my program but then the program should exit so that my processs continues.
I work on a stripped version of red hat (due to lack of space) , I have xloadImage and xv on my system. the command is executed by a 'system()' call in the source.

thnx!
0
Comment
Question by:themuppeteer
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11999626
xsetroot
0
 
LVL 2

Expert Comment

by:sneeuw_chan
ID: 12000420
Does xsetroot do what the OP requires (I.E. setting a single image at given coordinates) ?

AFAIK, you can't set part of the root background, you can only set the whole root at once.   If the image you supply is too small, it gets repeated (tiled, that is).  So if you don't want the upper left corner to be the upper left corner of your screen, and you don't want the image to repeat to the lower right, you're going to have to add borders to the image.

Do you have imlib on your computer ?  If so, I have a pretty small program I wrote years ago to set the background with.  It doesn't do black borders, but I'm sure that's relatively easy to add.  (If it compiles against the current imlib, that is...)

If you don't have imlib or another library to handle images, getting images into the right form to put in a window is a pretty big task in itself.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 350 total points
ID: 12000560
xsetbg -onroot -at X,Y file
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Expert Comment

by:gethemant
ID: 12026196
xsri
0
 
LVL 2

Author Comment

by:themuppeteer
ID: 12052264
Thanks for the input guys,
but so far nothing did the trick. I'm talking an image on ROOT window here. On x,y,w,h.
I still have to try xsri. I'll post again once I have more info.

grtz
themuppeteer
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 12053059
what is the problem with xsetbg?
0
 
LVL 2

Author Comment

by:themuppeteer
ID: 12053222
Hello ahoffman,
The problem with xsetbg is that it doesn't scale.

and the problem with xsri is that it is not present on the system. But I'll test it anyway and if it does what it has to do (x,y, width and height) then I might put it on the system.
0
 
LVL 2

Author Comment

by:themuppeteer
ID: 12054402
how do you get xsri on you r root window ? it only works on another then your root window.
0
 
LVL 2

Accepted Solution

by:
sneeuw_chan earned 150 total points
ID: 12063376
xsetbg has a -zoom option.
0
 
LVL 2

Author Comment

by:themuppeteer
ID: 12063874
yes indeed,that together with the border option get the job done.

(fyi /usr/X11R6/bin/xsetbg -display :0 -border black -onroot -at 96,160 -zoom 16 myimage.gif )



Thanks Guys, I'll split the points, 350 for ahoffman and 150 for sneeuw chan for making me look better to the zoom option. hope everybody is satisfied then ;)


Thanks a lot!
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 12064392
well done! themuppeteer understands EE's grading schema
Thanks and enjoy your pictures.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 163
Issues with Ports in Linux (Hyper-V Guest) 2 105
Use Powershell script to ftp 10 119
bash file 10 49
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question