Im looking to save an icon as a 2-bit PNG or BMP, any ideas? The lowest option in photoshop is 4-bit.

My icons are 4-levels grayscale and must be saved as a 2-bit image. Is there a trick or a converter or something? I created these icons in both vector and pixel format using illustrator and photoshop, the tricky part now is giving the developers a 2-bit image file.

Any suggestions are greatly appreciated.

  • How are you able to determine you are getting 4bit images? – Scott Aug 12 '15 at 20:28
  • Scott. When saving as a BMP I get a BMP options pop-up, 4-bit is an option (1, 4,16,24,32 bit are all the options). Then when clicking on the image properties it shows as bit depth: 4-bit. Im just wondering if there's a way to save it down to 2-bit. Is there a trick or another application I could use? – Alejandra Aug 12 '15 at 20:57

You might want to check out ImageMagick " software suite to create, edit, compose, or convert bitmap images."

Based on the conversion options, looks like you'd be able to try convert image.png -depth 2

  • it does not work . image still has 8 bit depth eb1_m.png PNG 421x500 421x500+0+0 8-bit sRGB 2c 1.12KB 0.000u 0:00.000 – Oleg May 18 '17 at 9:21
  • my last comment wrong, "sRGB 2c" means 2 bit image – Oleg May 18 '17 at 9:28

If you're using Adobe Photoshop you can simply press Ctrl + Shift + Alt + S to open the "Save for Web..."-Dialogue

Once you're there you just need to click at the top on the PNG-preset and change the amont of colors to "2". If they dont already appear as plain black and plain white you can set them manually.

There's also a filter available in Photoshop that lets you create exactly this effect.
The good thing about the filter is, that you can decide where exactly the white/black border is

  • Thanks Jonas! I dont need an effect, but the actual file to be 2-bit depth. GIMP does the trick. I created my icons as 4-bit and then convert and saved them as a 2-bit – Alejandra Aug 13 '15 at 15:07

If your editor does not natively support saving as indexed PNG, you will have to perform a destructive (lossy) operation, called "quantizing". Gimp isn't exactly lightweight and I have never gotten ImageMagick to do that properly, so I used a tool, called pngquant. It can reduce the image to palette with desirable number of colors, up to 2-bit, with or without added antialiasing. It has full alpha support.

Note, that images with lots of details (lines with non-integer width, lines thiner than 1px, fine curves) may not be represented with 2-bit palette without extreme quality loss, so experiment with colors count if you are not satisfied with result.

Also note, that some editors (Inkscape by default, Illustrator with some settings) won't pixel-align image elements, so quantizing will be less efficient due to the way multiple pixels are used for representing single "original" image pixel. If the image is sufficiently small, manually realigning lines to pixel boundaries may greatly improve the quality of result.

EDIT: I have got ImageMagick to work as well. Unfortunately, results of quantizing are very bad, compared to pngquant. There is an extra color in palette (e.g. requesting 8 colors produces png with 9 colors); images have severe artifacts, compared to same images, processed by pngquant. 2-bit images, produced by ImageMagick, are completely unusable.

All of above was observable with antialiasing and without.

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.