Cannot open 90% of recently saved images (webp format)
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:
sudo apt install webp
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.
dwebp FILE -o output_image.png
To convert webp to .png run the following command.
dwebp input_image.webp -o output_image.png # or output_image.jpg for jpg
To convert webp to .png with ImageMagick run the following command.
convert input.webp output.png
find . -type f -name "*.webp" -exec rename 's/.webp/.png/' {} +'
To convert multiple webp files to .png run the following command.
for x in ./*.webp; do
convert "${x%}" "${x%}".png
done
find . -type f -name "*.webp.png" -exec rename 's/.webp//' {} +
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.