Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

Hi I was wondering, how to set fedora to save screenshots as jpeg?

when i change the extension in the save dialog the file becomes corrupted

thanks

asked 24 Aug '11, 02:07

Kod's gravatar image

Kod
3126
accept rate: 0%




#!/bin/sh
# Michael O'Donnell linuxexchange20110907
# In general, the name of a file is an arbitrary string
# of characters.  The notion of an "extension" is just a
# convention - tacking a .com or .exe or .jpg or even .kittycat
# onto a filename does nothing to the contents of that file.
# If a file was created as (say) a PNG graphics file (and then,
# as is customary, stored with a name that ends in .png) you
# can't magically convert the contents of that file to the
# JPEG format by tacking .jpg onto the end of its filename -
# the actual contents of the file have to be converted.
# Once converted, we'd presumably store that new file with
# a name that indicates its new format but, again, that's just
# convention.
#
# This is a shell script that will use some low-level tools
# available on most Linux distributions:
#  - We first compute a known-unique temp file in the /tmp
#    directory, then...
#  - we announce our intention to sleep 5 seconds
#    before proceeding so that the user has a chance to
#    reposition/uncover/deiconify windows, then we invoke...
#  - xwd (the X Window Dumper) which captures the window you
#    click on (or the root window if invoked with -root)
#    and spews it to stdout in xwd-format, which we then
#    convert with...
#  - xwdtopnm (the xwd-format to PNM converter), which converts
#    its stdin and writes the resultant PNM bits to it stdout,
#    which we then feed to...
#  - pnmtojpeg (the PNM to JPEG converter) after arranging for
#    it to write its output to the temp file, which we announce.

function FAILED()  {
        echo FAILED: $*
        rm -f "$tempFile"
        exit 1
}

tempFile=`mktemp /tmp/screenCapture.XXXXXXXX.jpg` || \
                 FAILED mktemp /tmp/screenCapture.XXXXXXXX.jpg
echo "$0: sleeping 5 seconds before capture..." ; sleep 5
xwd $* | xwdtopnm | pnmtojpeg        >"$tempFile" || \
                 FAILED "xwd $* | xwdtopnm | pnmtojpeg >$tempFile"
echo "$0: result is $tempFile"
exit
link

answered 07 Sep '11, 15:21

mod's gravatar image

mod
393
accept rate: 0%

There's a simple workaround: save your screenshot in the default file format (PNG). Then double-click it in Nautilus to open it in Eye of Gnome. Then from EOG, select File > Save As... and change the extension to JPG there. It should then be saved as a valid JPG file.

The fact that the gnome screenshot dialog doesn't do this by default can be considered a bug.

link

answered 08 Sep '11, 07:51

reinouts's gravatar image

reinouts
1
accept rate: 0%

Use the import command, part of the imagemagic package.

Example: import -window root screenshot1.jpg

For other options: man import.

link

answered 04 Nov '11, 16:40

HerrHund's gravatar image

HerrHund
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×24
×8

Asked: 24 Aug '11, 02:07

Seen: 6,387 times

Last updated: 04 Nov '11, 16:40

powered by OSQA