Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to print the screen into a picture?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Tue Aug 28, 2018 12:22 am    Post subject: how to print the screen into a picture? Reply with quote

hello, there.
I want to print the screen into an image, but have no idea how to do it. Do I need to install some software?
Thanks in advace!
_________________
peace, focus.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Tue Aug 28, 2018 12:26 am    Post subject: Reply with quote

if imagemagick is installed you can use "import"
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Tue Aug 28, 2018 12:42 am    Post subject: Reply with quote

Some environments will take a screen shot with 'print screen' button. And 'shift+print screen' will let you draw a rectangle with the mouse to select the part of the screen to take. Not sure what window manager/desktop software is in use for that, but it's worth a try.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Tue Aug 28, 2018 12:57 am    Post subject: Reply with quote

use import from imagemagick

I have it bound to the print screen key but I run openbox.

anyway from the man page
Code:
NAME
       import  -  saves  any  visible window on an X server and outputs it as an image file. You can capture a single
       window, the entire screen, or any rectangular portion of the screen. The window  to  capture  is  selected  by
       clicking the desired window or a program option.

SYNOPSIS
       import [options] output-file

_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
gorg86
Apprentice
Apprentice


Joined: 20 May 2011
Posts: 299

PostPosted: Tue Aug 28, 2018 1:28 am    Post subject: Reply with quote

I use screengrab, gets the job done.
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Tue Aug 28, 2018 2:03 am    Post subject: Reply with quote

If you use Gnome, it has a Screenshot thingy (from search, type s c r ...) that lets you take a screenshot, either:
    a) Grab the whole screen
    b) Grab the current window
    c) Select area to grab

Another option,
If you are familiar with Gimp ... File->Create -> Screenshot

Regards
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Tue Aug 28, 2018 4:32 am    Post subject: Reply with quote

If you're using KDE you could install kde-apps/spectacle and use keyboard shortcuts ('System Settings' > 'Workspace' > 'Shortcuts' > 'Custom Shortcuts'):

Quote:
Screenshots
 |- Start Screenshot Tool                  PrtScr
 |- Take Full Screen Screenshot        Shift+PrtScr
 |- Take Active Window Screenshot   Meta+PrtScr


Have you tried one of the various other screen capture applications, such as Scrot? You could also set up a shortcut to the PrtScr key to capture a full screen, to Alt+PrtScr to capture the active window, and so on using Scrot:

Code:
SYNOPSIS
       scrot [options] [file]

DESCRIPTION
       scrot  is  a  screen  capture utility using the imlib2 library to acquire and save images.  scrot has a few options,
       detailed below. Specify [file] as the filename to save the screenshot to.  If  [file]  is  not  specified,  a  date-
       stamped file will be dropped in the current directory.

OPTIONS
       -h, --help
            display help output and exit.

       -v, --version
            output version information and exit.

       -b, --border
            When selecting a window, grab wm border too

       -c, --count
            Display a countdown when used with delay.

       -d, --delay NUM
            Wait NUM seconds before taking a shot.

       -e, --exec APP
            Exec APP on the saved image.

       -q, --quality NUM
            Image  quality  (1-100)  high value means high size, low compression. Default: 75. (Effect differs depending on
            file format chosen).

       -m, --multidisp
            For multiple heads, grab shot from each and join them together.

       -s, --select
            Interactively select a window or rectangle with the mouse.

       -u, --focused
            Use the currently focused window.

       -t, --thumb NUM
            generate thumbnail too. NUM is the percentage of the original size for the thumbnail to be.

       -z, --silent
            prevent beeping.

SPECIAL STRINGS
       Both the --exec and filename parameters can take format specifiers that are  expanded  by  scrot  when  encountered.
       There  are two types of format specifier. Characters preceded by a '%' are interpreted by strftime(2). See man strf‐
       time for examples.  These options may be used to refer to the current date and time.  The second kind  are  internal
       to scrot and are prefixed by '$' The following specifiers are recognised:

       $f image path/filename (ignored when used in the filename)
       $n image name (ignored when used in the filename)
       $s image size (bytes) (ignored when used in the filename)
       $p image pixel size
       $w image width
       $h image height
       $t image format
       $$ prints a literal '$'
       \n prints a newline (ignored when used in the filename)

EXAMPLE
       scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/'
       This would create a file called something like 2000-10-30_2560x1024.png and move it to your shots directory.


There are various other screen-capture utilities. For example you could use x11-apps/xwd and media-gfx/imagemagick in a Bash script launched by a keyboard shortcut for PrtScr (albeit more complicated than Anon-E-moose's imagemagick import approach):

Code:
#!/bin/bash
DISPLAY=:0 xwd -root > /tmp/screenshot.xwd
convert /tmp/screenshot.xwd /home/fitzcarraldo/screenshot.png


Or you could use media-libs/netpbm instead of imagemagick:

Code:
#!/bin/bash
DISPLAY=:0 xwd -root | xwdtopnm | pnmtopng > /home/fitzcarraldo/screenshot.png

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Aug 28, 2018 7:30 am    Post subject: Reply with quote

Fitzcarraldo wrote:
Code:
#!/bin/bash
DISPLAY=:0 xwd -root > /tmp/screenshot.xwd
convert /tmp/screenshot.xwd /home/fitzcarraldo/screenshot.png

Fitzcarraldo ... probably best not to hardcode things that may be variable:

Code:
#!/bin/sh
set -e
xpid="$(pgrep -n X)"
display="$(egrep -aoz ':[0-9](.[0-9])?' /proc/$xpid/cmdline)"
dat="$(date +'%d-%m-%Y-%H%M%S')"
DISPLAY="$display" xwd -root > ${TMPDIR:-/tmp}/screenshot-${dat}.xwd
convert ${TMPDIR:-/tmp}/screenshot-${dat}.xwd $HOME/screenshot-${dat}.png

best ... khay
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Tue Aug 28, 2018 10:10 am    Post subject: Reply with quote

The only reason I mentioned import is I already had imagemagick because other packages used/needed it.

I used to use screengrab and if all you need is just the screen grabber then it or one of the others would work fine.
In other words there are several ways to get images of your desktop or portions of it.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Wed Aug 29, 2018 1:10 am    Post subject: Reply with quote

Thanks everyone!
Every time I have a question here, I am moved by the passion in this forum.
I may try imagemagick first.
Thanks again.
_________________
peace, focus.
Back to top
View user's profile Send private message
soundrolf
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2016
Posts: 122
Location: Cologne / Germany

PostPosted: Fri Sep 07, 2018 11:55 am    Post subject: Re: how to print the screen into a picture? Reply with quote

I put this into my .bashrc:

Code:
function shot()
{
import -frame -strip -quality 75 "$HOME/$(date +%s).png"
}

You must have Imagemagick Installed.

Type in terminal 'shot' then you have a Screenshot

[Moderator edit: added [code] tags to preserve output layout - although in this case, there appears to be no layout to preserve. -Hu]
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Fri Sep 07, 2018 2:11 pm    Post subject: Reply with quote

I have a special directory for screen shots, $HOME collects all kinds of crap from everywhere. ~/Pictures/Screenshots in my case.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum