I use IM to display an image for a few seconds via a simple animation loop. The image is always displayed in the top left-hand corner of my monitor screen. So far, using "backdrop" appears to be the only way to center the image on the screen. Unfortunately, using "backdrop" occupies the entire screen.
Is there a simple way to display a centered image that does not cover my screen entirely (other than making areas of the image transparent)?
Thank you
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
Centering image on screen
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Centering image on screen
try this:
display -geometry 640x480+200+100 logo:
works for me on IM 6.6.9.5 Q16 Mac OSX Tiger to move the window 200 to the right and 100 down. You can also try just using
display -geometry 100%x100%+200+100 logo:
which works but I get a small thumbnail image as well. Unfortunately, -gravity center does not help in the display on my system; that is the combination of -gravity center and -geometry 640x480+0+0 does not make it centered.
display -geometry 640x480+200+100 logo:
works for me on IM 6.6.9.5 Q16 Mac OSX Tiger to move the window 200 to the right and 100 down. You can also try just using
display -geometry 100%x100%+200+100 logo:
which works but I get a small thumbnail image as well. Unfortunately, -gravity center does not help in the display on my system; that is the combination of -gravity center and -geometry 640x480+0+0 does not make it centered.
Re: Centering image on screen
I had tried "gravity -Center", but my version of IM doesn't recognize this option. I should install the latest version from source.
Also, I need to look more closely at the "gravity"option as it seemed (at first glance) to be more for positioning, say text, within an image as opposed to positioning the image relative to the screen coordinates.
Something that uses "center" instead of coordinates is what I'm looking for as the image will be displayed on screens of varying size and resolution - but thanks.
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
Also, I need to look more closely at the "gravity"option as it seemed (at first glance) to be more for positioning, say text, within an image as opposed to positioning the image relative to the screen coordinates.
Something that uses "center" instead of coordinates is what I'm looking for as the image will be displayed on screens of varying size and resolution - but thanks.
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Centering image on screen
Window placement (beyond X window -geometry specifications) is actually a function of YOUR window manager, not the application!!!!!
In my OpenBox window manager I have a RC file in which I can specify excatly which 'desktop' and where on the screen I want specific applications. Typically I can 'name' the application to make it special for that specific task.
Another alternative is to use other X window, window management tools, like xdotool, xwit, and wmctrl which will let you move, request window resize, iconify, de-iconify, any window you like!
I have used such tools to create a shell scripted X window application out of various utility programs. especially X window display tools that allow some remote control of the image displayed.
"display" does allow some remote control of the displayed contents. Even "animate" does.
I have used this fact in a shell script that displays one image, then creates a 'fade to new image' animation whcih it then passes to animate, to action. After that it picks a new image and repeats the process. The point was that the next image and the fade to that image is picked on the fly. --- And it worked!!!
See scripts..
http://www.imagemagick.org/Usage/script ... show_morph
and one where a external script or the user specifies the next image
http://www.imagemagick.org/Usage/scripts/slideshow_next
In my OpenBox window manager I have a RC file in which I can specify excatly which 'desktop' and where on the screen I want specific applications. Typically I can 'name' the application to make it special for that specific task.
Another alternative is to use other X window, window management tools, like xdotool, xwit, and wmctrl which will let you move, request window resize, iconify, de-iconify, any window you like!
I have used such tools to create a shell scripted X window application out of various utility programs. especially X window display tools that allow some remote control of the image displayed.
"display" does allow some remote control of the displayed contents. Even "animate" does.
I have used this fact in a shell script that displays one image, then creates a 'fade to new image' animation whcih it then passes to animate, to action. After that it picks a new image and repeats the process. The point was that the next image and the fade to that image is picked on the fly. --- And it worked!!!
See scripts..
http://www.imagemagick.org/Usage/script ... show_morph
and one where a external script or the user specifies the next image
http://www.imagemagick.org/Usage/scripts/slideshow_next
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Centering image on screen
-gravity works well for positioning when compositing one image relative to another bigger one.Also, I need to look more closely at the "gravity"option as it seemed (at first glance) to be more for positioning, say text, within an image as opposed to positioning the image relative to the screen coordinates.
see http://www.imagemagick.org/Usage/compose/#compose_terms and http://www.imagemagick.org/Usage/layers/#convert
Re: Centering image on screen
Is there a way to use "backdrop" so that the backdrop colour is transparent? This would center the image but allow the other "X window activity" to show through.
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Centering image on screen
Have you explored combinations of -backdrop and -geometry and -gravity and -background none in the same display command from the options at http://www.imagemagick.org/script/display.php
In my tests, it does not look like -background none or -background transparent or -background "rgba(0,0,0,0)" are recognized colors.
In my tests, it does not look like -background none or -background transparent or -background "rgba(0,0,0,0)" are recognized colors.
Re: Centering image on screen
I'll have to update my version of IM for gravity options to be recognized. Somehow I had the distinct impression that the "background" option did not pertain to the backdrop that fills the screen, but related to the canvas and images . I'm pretty much a newbie with graphics so here goes. Thanks fmw42!fmw42 wrote:Have you explored combinations of -backdrop and -geometry and -gravity and -background none in the same display command from the options at http://www.imagemagick.org/script/display.php.
Interesting animation scripts Anthony, I'll bookmark for future reference.
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Centering image on screen
viper-2 wrote:I'll have to update my version of IM for gravity options to be recognized. Somehow I had the distinct impression that the "background" option did not pertain to the backdrop that fills the screen, but related to the canvas and images . I'm pretty much a newbie with graphics so here goes. Thanks fmw42!fmw42 wrote:Have you explored combinations of -backdrop and -geometry and -gravity and -background none in the same display command from the options at http://www.imagemagick.org/script/display.php.
Interesting animation scripts Anthony, I'll bookmark for future reference.
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com
I am no expert on this either. I was just trying various combinations of what looked like perhaps useful options for display. Unfortunately, I could not get anything to work the way you want with transparency, though -geometry did move the window. As Anthony says, it is also a factor of your version of X11 and your operating system. I am on a Mac and have had numerous issues, for example, when the image has transparency even the window frame goes transparent, thus it is hard to find the boundary of the image. For me -gravity did not help. Though in other applications such as compositing it works in concert with -geometry. I think your issue is needing some way of building the transparent background. But on my system, the colors with transparency are not recognized by -background. So I don't know exactly how to help.
Fred
Re: Centering image on screen
I'm only getting simple colour recognition with "background" too. I'm actually calling imagemagick with "animate' as a sort of pseudo splash screen at the start of an application. I think I'll just use a default setting for the size and offsets that will look good for most screen sizes, and forget about backdrop as this "takes over" the users' entire screen. Since "gravity" isn't working on my debian lenny box I won't use it as it won't work on some users' systems either.fmw42 wrote:Unfortunately, I could not get anything to work the way you want with transparency, though -geometry did move the window. As Anthony says, it is also a factor of your version of X11 and your operating system.... I think your issue is needing some way of building the transparent background. But on my system, the colors with transparency are not recognized by -background. So I don't know exactly how to help.
Fred
When I find the time, I'll code a proper splash screen in Python.
Thanks for trying Fred.
Cheers!
agt
--
Freedom - no pane, all gaiGN!
Code Art Now
http://codeartnow.com
Email: agt@codeartnow.com