• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

I want to display an image...

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
themuppeteer
Asked:
themuppeteer
  • 4
  • 4
  • 2
  • +1
2 Solutions
 
ahoffmannCommented:
xsetroot
0
 
sneeuw_chanCommented:
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
 
ahoffmannCommented:
xsetbg -onroot -at X,Y file
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
gethemantCommented:
xsri
0
 
themuppeteerAuthor Commented:
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
 
ahoffmannCommented:
what is the problem with xsetbg?
0
 
themuppeteerAuthor Commented:
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
 
themuppeteerAuthor Commented:
how do you get xsri on you r root window ? it only works on another then your root window.
0
 
sneeuw_chanCommented:
xsetbg has a -zoom option.
0
 
themuppeteerAuthor Commented:
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
 
ahoffmannCommented:
well done! themuppeteer understands EE's grading schema
Thanks and enjoy your pictures.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now