Reputation: 6058
I am trying to generate a screenshot of a firefox window in my terminal, but I keep getting an error:
root@host [~]# DISPLAY=:1 firefox http://www.cnn.com & sleep 5 && DISPLAY=:1 import -window root -crop 1264x948+0+25 -quality 90 /usr/local/apache/htdocs/screenshot1.jpg && pkill firefox
[1] 30200
import: unable to open X server `:1' @ import.c/ImportImageCommand/364.
Why is this happening? How can I fix it?
Upvotes: 5
Views: 25274
Reputation: 86
Can you tell us what are the result when you type
ls -la /tmp/ | grep X
and
ps | grep X
Also, I had some trouble with using the DISPLAY=:1 syntax, so instead I use:
firefox --display=:1 URL_OF_SITE
import -display :1 -window root etc...
Upvotes: 0
Reputation: 3402
It looks like you used changed to root in the terminal after starting it (or did you login to X as root?). If that's the case the display can't be opened because it's owned by another user and you can't just go and display stuff somebody else's display.
Exit the root session and it will probably work. If you want it to work from the root session take a look at 'man xhost'.
Upvotes: 0