Score:4

How to convert webp to grayscale png?

cn flag

I have a bunch of webp images and need to convert them to png format. I know png supports different color modes like grayscale which I need.

Is there any Linux tool or online services to achieve this fast and easy?

I tried different online converters, but all of them convert webp to png with default RGB color mode.

Michal Przybylowicz avatar
eg flag
Check this answer https://askubuntu.com/questions/457604/bulk-converting-images-from-one-format-to-another
Greenonline avatar
us flag
Does this answer your question? [Bulk converting images from one format to another?](https://askubuntu.com/questions/457604/bulk-converting-images-from-one-format-to-another)
Score:7
cg flag

This can be done on the command line using the imagemagick package. This has the advantage that it becomes easy to script for an entire directory of images (hint: either combine with the find -exec command or a bash for loop).

First install the package:

sudo apt update && sudo apt install imagemagick

Download an example webp image to test it out on:

wget https://www.gstatic.com/webp/gallery/1.webp

The imagemagick command:

convert 1.webp -colorspace Gray 1.png

You should now have a black and white png image in the same directory. -colorspace Gray converts the image to black and white.

For more info, try: man convert

Score:3
by flag

Use GIMP 2.10.

click file>open and select open .webp file. Now go to image>mode>Grayscale Now go to File>export as and export as yourfilename.webp

and that is your image is converted to grayscale. While exporting it is upto you if want to select lossless or lossy.

pl flag
Wait... there's lossy PNGs?
Ajay avatar
by flag
No I write about .webp format.
Score:3
ci flag

Use Inkscape 1.1.1,

Open .webp file by click Open in File menu [File > Open]
Now click on Export PNG Image... in File menu. [File > Export PNG Image...]
On the side, in the Export PNG Image tab and Drawing sub-tab, click on the Advanced accordion.
Set Bit depth on Gray_1, Gray_2, Gray_4, Gray_8, Gray_16, GrayAlpha_8 or GrayAlpha_16 based on your needs.
Enter Filename with .png extension and click on Export button.

This will convert your webp file to grayscale png.

cn flag
Is there a benefit to using Inkscape (optimised for vector graphics) over GIMP for raster file converting between these raster formats?
Maria Raynor avatar
ci flag
@ChrisH Two separate applications offer different settings to the user. However, this is a way to convert `webp` to `png`.
Score:1
jp flag

ffmpeg example

Using the format filter to set grayscale:

ffmpeg -i input.webp -vf format=gray output.png

See FFmpeg & Black and White Conversion for several other methods.

Convert an entire directory

Use a Bash for loop:

for f in *.webp; do ffmpeg -i "$f" -vf format=gray "${f%.*}.png"; done

Adapted from How do you convert an entire directory with ffmpeg?

Score:1
ru flag

If you are looking for an online tool with the support of converting to grayscale PNG, this online WebP to PNG converter by Vertopal will do the trick.

Based on the tools section bottom of the page, it supports 8-bit grayscale:

Convert WEBP to Black & White (monochrome) PNG, 8-bit Grayscale PNG, 24-bit RGB PNG, and 32-bit RGBA PNG.

I used a WebP image from Google Developers WebP Gallery for the test:

Original WebP Image

Converted to 8-bit grayscale PNG

It worked just fine. Good luck.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.