Results 1 to 10 of 10

Thread: I want to print screen and then open in a graphic viewer

  1. #1
    Join Date
    Oct 2015
    Beans
    5

    I want to print screen and then open in a graphic viewer

    I'm interested in print screen capture and then pasting the image into a viewer. How can I do this ? I'm using Ubuntu 20.04. I'm also very new to Linux let alone Ubuntu.

    Thanks in advance

  2. #2
    Join Date
    May 2008
    Beans
    3,947
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: I want to print screen and then open in a graphic viewer

    Show Applications > Utilities > Help > Tips & Tricks > Screenshots and Screencasts

  3. #3
    Join Date
    Oct 2015
    Beans
    5

    Re: I want to print screen and then open in a graphic viewer

    Quote Originally Posted by tea for one View Post
    Show Applications > Utilities > Help > Tips & Tricks > Screenshots and Screencasts
    Great thank you.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: I want to print screen and then open in a graphic viewer

    Sorry, I don't know an easy way, but I do know a way that is 3 steps using a little script and connecting a keyboard chord to make it happen.
    Perhaps some other people will respond with an easier way.

    I'm using imagemagick tools. You'll want to install that package. The import command only works with X11, so Wayland probably won't work.

    To grab the screen, use:
    import -display :0.0 -window root -colorspace RGB -quality 80 /tmp/screendump.png

    To open that in a viewer tool:
    display /tmp/screendump.png

    To hook up the script with those 2 lines, I'd use a setting in my window manager. That is extremely specific to the WM, so you'll need to look up how to do that for the DE that you use. "Ubuntu Desktop Guide" will have steps for stock Gnome3 DE in the default Ubuntu Desktop.

    Let me test those 2 command first ... ok, that worked. Here's my little script:
    Code:
    #!/bin/bash
    FILE="/tmp/screendump.png"  # this could be timestamped or random for each run.
    /usr/bin/import   -display :0.0     -window root    -quality 80    "$FILE"
    
    # To open that in a viewer tool:
    /usr/bin/display   "$FILE" &
    I removed the colorspace option to prevent an odd color change. If you want to keep the files, you can put a time-stamp into the filename, so they are unique from run to run. Click anywhere in the image to see a menu or press 'q' to quit and the file will be left in /tmp/.

    For those using openbox, the XML config file could be ~/.config/openbox/rc.xml. There should be an existing one. The openbox process would have the --config option listed. That's the file.
    Code:
        <keybind key="W-2">
          <action name="execute">
            <command>firejail thunderbird</command>
          </action>
        </keybind>
        <keybind key="W-3">
          <action name="execute">
            <command>firejail keepassxc</command>
          </action>
        </keybind>
      <keybind key="W-4">
          <action name="execute">
            <command>~/bin/grab-screen-and-view</command>
          </action>
        </keybind>
    is how to setup <Super>-2 and <Super>-3 to run thunderbird or keepassxc inside a lightly constrained firejail. The command could easily point to a script like above in your ~/bin/ directory. <Super>-4 is tied to my script. Name it whatever you like, but be consistent everywhere and make certain the file permissions are set to 700.

    import without the -root and -display option will wait for a rectangle to be selected. Like this:
    Code:
         /usr/bin/import    -quality 80    "$FILE"
    I've probably left out a few details that someone new would need to handle. Sorry if I forgot something. Hopefully someone else will point it out.

    I have to do things this way in part because I don't run any DE and choose to run an older window manager. There are trade-offs with our choices. fvwm has very little bloat, uses little memory, little CPU, and is very fast on all hardware. It has extensions for all sorts of things, including custom extensions, multiple virtual desktops, and the overall fvwm features haven't changed much the last 15+ yrs. OTOH, it doesn't have any GUI configuration tool for tweaks and some of the configuration options are not exactly intuitive. Trade-offs.
    Last edited by TheFu; October 27th, 2020 at 02:35 AM.

  5. #5
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: I want to print screen and then open in a graphic viewer

    On Kubuntu you can use the PrtSc key. The application it launches lets you take a variety of screenshots from full screen to specific windows to a custom rectangle. The screenshots get saved to a configurable directory. On my machine, if I take a screen shot, a notification box pops up that I can click on to open the file in the viewer program Gwenview.

    Don't know if it works similarly on vanilla Ubuntu.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: I want to print screen and then open in a graphic viewer

    On Xubuntu pressing print-screen key gives me a window with options as shown in my screenshot.

    I have keyboard shortcuts set up to take screenprints of either the whole screen (Print screen), the active window (Print screen +Windows key) or a mouse selected area (Print screen + Alt).

    Sorry but the attachments facility is not working at the moment; I'll try later, but the options offered are
    • Save
    • Copy to clipboard
    • Open with
    • Host on imgur
    Attached Images Attached Images
    Last edited by ajgreeny; October 27th, 2020 at 08:42 PM.

  7. #7
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,783

    Re: I want to print screen and then open in a graphic viewer

    The Gimp photo editor has a screenshot feature - in the File menu.

  8. #8
    Join Date
    Aug 2017
    Location
    melbourne, au
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: I want to print screen and then open in a graphic viewer

    Modern Lubuntu uses the LXQt desktop, where the image viewer is `lximage-qt` which has a screenshot function (`lximage-qt -s`) where the default isn't to save the image, but show it in the image viewer itself (allowing save of course; lx-image-qt also has some very simple editing functions too like adding arrows, boxes etc but in no ways is it an editor). A shortcut key is just set to run it when PrintScreen is pressed...

    It's not what I'd use in a Ubuntu desktop though; it's efficient in a Qt5 base but Ubuntu is GTK3 so I'd opt for a prior alternative.

    https://packages.ubuntu.com/focal/lximage-qt
    https://packages.ubuntu.com/focal/screengrab

    (`screengrab` is another like program use by Lubuntu too; depending on release it'll do the job but I'd use a GTK3 based application on main Ubuntu)

  9. #9
    GhX6GZMB is offline Iced Almond Soy Ubuntu, No Foam
    Join Date
    Jun 2019
    Beans
    1,093

    Re: I want to print screen and then open in a graphic viewer

    Everyone has her/his favourite way of dealing with screenshots.

    I prefer using the PrtScr key and automatically placing the shot on the Clipboard. From there it can be used by any program using the "Edit/Paste" menu.

    Either as PrtScr (full screen) or Alt+PrtScr (active window).

    You'll need to assign commands to the PrtScr key. ("Keyboard shortcuts"). Those are "scrot" and "xclip".

    PrtScr: sh -c 'scrot -o /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f''
    Alt+PrtScr: sh -c 'scrot -o -u /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f''

    Either keystroke will store the latest screenshot on the clipboard (older will be overwritten). I don't use a "select a screen area" command, as I find this easier to do after pasting into the subsequent program.

    Cheers.

    PS: the quotation marks at the end of each command are two single quotes, NOT one double quote.
    Last edited by GhX6GZMB; October 27th, 2020 at 08:29 PM.

  10. #10
    Join Date
    Jan 2013
    Beans
    14

    Re: I want to print screen and then open in a graphic viewer

    An alternate solution that I can offer and may help is getting the app called Flameshot, its like snipping tool for windows. or You can also use Gnome Screenshot. Thought i'd try to assist in some way Good luck.

    P.s. this can be downloaded in the snap store in ubuntu.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •