This computer is running on Lubuntu. Print Screen will do a screenshot and save it automatically. However, the default image file is saved as png. I'd like to save it as jpg automatically.

I tried to look through the system preference and such but no luck. Is there any command or setting that I can change so that it will save as jpg instead of png? I'd prefer to not install any new apps like the search results have suggested >.< unless of course that it is really the only solution.

  • 1
    I can not help you with changing the default save format, but I am curious as to why you would want JPEG instead of PNG. 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. – fouric Oct 7 '12 at 1:03
  • Now that I think about it, I don't really have a reason I guess LOL. I instinctively wanted jpg because that is the image file type that I see and use most. I always choose jpg by default. – Joey Oct 7 '12 at 4:04
  • This askubuntu.com/questions/55204/… might help you. The only way to change the file ext to jpg/jpeg is by writing a wrapper script – devav2 Oct 7 '12 at 4:54
  • @devav2 This will not work for Lubuntu as its using scrot instead of gnome-screenshot. Edit: nervermind this, actually it will. But it's a pretty dirty workaround. – Glutanimate Oct 7 '12 at 5:37

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">

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.