How to change screenshot file type from png to jpg when doing a Print Screen on Lubuntu?
I concur with @InkBlend: png
should be the screenshot format of your choice. As pointed out by Inkblend:
Not only is PNG lossless, but it has none of the patent issues that have encumbered JPEG in the past. And PNG supports transparency, while JPEG does not.
But, for whatever reason, if you'd still like to use jpeg
, there is a way. I fear you will have to mess around with configuration files a bit, though.
This will also enable you to change the screenshot naming scheme and where they are saved by default.
Modifying image format
Shortcuts are defined in Lubuntu's openbox config file. First let's make a backup copy:
cp ~/.config/openbox/lubuntu-rc.xml ~/.config/openbox/lubuntu-rc.xml.backup
Ok, now for the modification. Open it up with an editor:
leafpad ~/.config/openbox/lubuntu-rc.xml
Search for the following section:
<!-- Launch scrot when Print is pressed --> <keybind key="Print"> <action name="Execute"> <command>...</command> </action> </keybind>
Note the <command>...</command>
line. ...
represents what was originally there. Replace ...
with:
scrot '%Y-%m-%d_$wx$h.jpeg'
Save lubuntu-rc.xml
, close your editor and update Openbox with the new configuration by running the following from a terminal:
openbox --reconfigure
Screenshots taken with this modification will be named something like this: 2000-10-30_2560x1024.jpeg
. Scrot
will automatically choose the filetype defined by the file name.
Additional modifications
If you don't like this naming scheme, you can easily introduce other parameters into the file name. Here's an overview:
$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 '$'
If you want to define a different screenshot folder, e.g. your Pictures folder, you can do so with this command:
scrot '%Y-%m-%d_$wx$h.jpeg' -e 'mv $f ~/Pictures/'
Restoring previous settings
You can revert any changes by replacing the modified file with your backup:
cp ~/.config/openbox/lubuntu-rc.xml.backup ~/.config/openbox/lubuntu-rc.xml
Hope this helps.