Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to save an image as 24 bit png? I didn't manage with GIMP. Keep in mind this is pixel art so keeping the exact colors are important.

I tried several things in GIMP, but it always said this:

$ file Junction.png 
Junction.png: PNG image data, 160 x 60, 8-bit/color RGBA, non-interlaced

Instead of 24 bit.

share|improve this question
    
8-bit/color is a 24 bit PNG (3 colors * 8 bits). Did you mean a 48 bit PNG (16-bit/color)? –  cjm Nov 23 '13 at 8:21
    
In paint.NET you can choose to save your picture 8bit, 24bit or 32bit. As there is no pain.NET on Linux and Pinta doesn't have it, I asked for it. –  PMint Nov 23 '13 at 14:42
add comment

3 Answers 3

up vote 3 down vote accepted

Your problem is that you don't understand the output of the file command. I used Paint.NET to save an image as 32-bit PNG, 24-bit PNG, and 8-bit PNG. Then I ran the file command on them:

$ file *bit.png
08-bit.png: PNG image data, 800 x 600, 8-bit colormap, non-interlaced
24-bit.png: PNG image data, 800 x 600, 8-bit/color RGB, non-interlaced
32-bit.png: PNG image data, 800 x 600, 8-bit/color RGBA, non-interlaced

As you can see 8-bit/color RGBA is actually what Paint.NET calls a 32-bit PNG, because it's 8 bits per color * (3 colors + 1 alpha channel). 8 * 4 = 32. A 24-bit PNG is the same, but without the alpha channel: 8 * 3 = 24.

If you want what Paint.NET calls a 24-bit PNG, you need to remove the alpha channel. As far as I can tell, GIMP always exports a PNG with an alpha channel if any of your layers has an alpha channel.

If you're only using 1 layer, then it's simple: Go to Layer > Transparency > Remove Alpha Channel and then export. You'll get a 24-bit PNG.

If you're using multiple layers and need transparency effects, then jthill pointed out that you can use Image > Flatten Image to remove the layers with transparency before exporting. You can then Undo to restore the layers.

You can also post-process the exported PNG to remove the alpha channel. You could load the exported image back into GIMP, which will make it 1 layer, remove the alpha channel from that layer, and export again. A better way is to use optipng, which will usually compress a PNG better than GIMP can in addition to removing a useless alpha channel.

share|improve this answer
add comment
Image->Flatten
File->Export
Edit->Undo
~/Documents$ file Untitled.png 
Untitled.png: PNG image data, 640 x 400, 8-bit/color RGB, non-interlaced
share|improve this answer
add comment

NOTE: If you're looking for 16-bits per channel support then this answer applies to that. Otherwise if you're miss understanding 24-bit support (8-bit * 3 colors (RGB) = 24-bits, then see @cjm's answer as to how to understand how that works.


From the GIMP FAQ:

excerpt

When can we see 16-bit per channel support (or better)?

For some industries, especially photography, 24-bit colour depths (8 bits per channel) are a real barrier to entry. Once again, it's GEGL to the rescue. Work on integrating GEGL into GIMP began after 2.4 was released, and will span across several stable releases. This work will be completed in GIMP 3.0, which will have full support for high bit depths. If you need such support now and can't wait, cinepaint and Krita support 16 bits per channel now.

The current development branch, GIMP 2.9.x, supports higher bit depths than the 2.8 and older 8-Bit-per-component...

In case you're not familiar with GEGL:

excerpt

GEGL (Generic Graphics Library) is a graph based image processing framework.

GEGL provides infrastructure to do demand based cached non destructive image editing on larger than RAM buffers. Through babl it provides support for a wide range of color models and pixel storage formats for input and output.

Features

  • Floating point handling and processing and output of larger 8bit, 16bit integer and 32bit floating
  • ....
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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