I very recently installed Ubuntu 20.04 on my laptop and have been having this issue where I can't open most of the images I have saved. I get an error that says
Unrecognized Image File Format
(but they are literally just jpgs and PNGs).
I've tested the images by moving them to my thumb drive and then my Windows PC and they open up fine. I can also select Open with Firefox and that works but it's inconvenient. I've attempted to rename them and have the same issue. I've tried updating, upgrading, rebooting, and opening the images from the terminal and still I can't open some dumb wallpaper I saved from reddit.
How do I go about fixing this?
Update:
so I was able to figure this out, as it turns out these were webp images, which is odd because they all saved under .jpg or even .png without me intervening. So I've installed something that can view them properly, but there's still an issue. If I were to link an image in an email or on a website or something I won't be able to actually see what it is I'm linking unless I were to open up in a separate window first. So I'm unsure what to do about that.
source: OP's comment
The 90% of the images that you were unable to open are .webp image files which are becoming more and more common on the web. webP uses the modern VP8 compression format to deliver efficient compression of images for the web. More than 30% extra gain over optimized JPEG for the same quality is not unusual. You can see the difference in quality when you decompress a .webp file.
In all currently supported versions of Ubuntu open the terminal and type:
Let's assume you have an image file named FILE that doesn't show a thumbnail image in Files file manager and returns an
Unrecognized Image File Format
error when you try to open it. To convert a .webp file named FILE to .png run the following command.To convert webp to .png run the following command.
To convert webp to .png with ImageMagick run the following command.
To convert multiple webp files to .png run the following command.
The webp package also contains the
cwebp
command.cwebp
compresses an image using the WebP format. Input format can be either PNG, JPG, TIFF, WebP or raw Y'CbCr samples.I share my primitive script that I use to convert webp files to more traditional formats. This way they can be used anywhere in the default Ubuntu desktop, including working thumbnails in Nautilus.
Please note: I'm a hobbyist in this department, not a reliable expert. If you use / tinker on this script, that's your choice and responsibility.
The script depends on the
webp
package being installed. It iterates over every *.webp file found in a given directory and its sub-directories recursively.It converts to png, because that's my preference, but that can be changed in the line starting with
dwebp
. Alternatively a variable could be introduced for the fileneme extension, to make it more ergonomic.It also has a fallback action, because sometimes dwebp fails to convert: in my experience, sometimes files saved with .webp extension (by Firefox) are still just regular .jpg's or .png's inside. Then dwebp returns with an error. I figured most of the time, such files are .jpg's so in the fallback action I rename them as such. I think it would be very well possible to make the script find out the true format in such cases; but since it happens so infrequently, I just rather search for the the filename segment "webp-convert-fallback" in Nautilus, see if any of them fails to show a thumbnail, and try to rename them to other extensions manually (usually they are either .png's or .gif's then).
Also there was a challenge with filenames containing spaces, but I kept refactoring until it worked (on GNU bash version 5.0.17).
Additionally I quickly mention, that in Firefox it is (at least it was) possible to disable working with .webp images. This would work such way that Firefox would send such request headers to the web-servers that suggest that it cannot deal with webp files; normally it should trigger web-servers to send the image in a traditional format. (Search for "webp" in Firefox's
about:config
page.)But I stopped opting out from using webp's this way, because I have encountered a webshop that did not provide fallback images; seeing no images in a webshop made it pretty much unusable. Thus I had to give in, and let Firefox use webp's; that's how I ended up with the converting script.
qView
is a lightweight image viewer that supports .webp.Enter the following commands to install it from its official PPA.
If you don't want to add another PPA, you can simply get the .deb/appimage/flatpak instead.
ImageMagick (terminal command: display) will open just about anything nowadays. It's not real picky as to what the file extension shows as, either, unlike most distros photo viewers. You might not find it in your menus, but you should be able to "open with" when selecting any image format (tif, png, jpeg, jpg, webp, etc.) in the context menu (right click a picture file) of your file manager. AND it has a bunch of options in its menus, such as finding all image info (in the misc. section) or saving as just about any format (that's in file> save> format button (and then type in a name (even the current name) including matching file extension, such as jpg. It's included in most distros! Yes, it's a little hard to use with the menus it has. But read the documentation and you'll be amazed: imagemagick.org