Page 1 of 1

Increase Bits Per Channel

Posted: 2016-04-10T16:33:25-07:00
by Bighead
So I'm trying to convert a PNG image that has varying bits per channel to have all 8-bits per channel. Using -verbose on the image, this is what it tells me.

Channel depth:
red: 8-bit
green: 8-bit
blue: 1-bit
alpha: 1-bit

For my application, all channels must be encoded with 8-bits. I've tried a ton of the commands to force the output but nothing seems to be working. When I use -verbose on the resulting image this is what I need to see.

Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 8-bit

Can anyone offer me some insight into how to accomplish this? I've tried using everything I could think of including:

convert input.png -depth 16 -define png:color-type=6 PNG32:output.png

But the output Image is exactly the same as the input image.

Re: Increase Bits Per Channel

Posted: 2016-04-10T16:44:19-07:00
by snibgo
Bighead wrote:Using -verbose on the image, this is what it tells me.
It tells you information about the image. The image needs only 1 bit per pixel in the blue channel. Therefore we know it has only one or two values.

It tells you nothing about how the data is stored in a PNG file.

Re: Increase Bits Per Channel

Posted: 2016-04-10T16:57:59-07:00
by Bighead
I'm going to be honest there's a lot about image encoding that I do not know, but this is what I do know.

The PNG is being loaded as a texture using SOIL in Dolphin emulator.
http://www.lonesock.net/soil.html

One of the limitations of SOIL is:
- 8-bit samples only (jpeg, png)

After analyzing over a 100 PNG files, any image (texture) that does not have at least 8-bits in each channel when I read it with IM using "verbose" does NOT load into the game.

So my question is still how do I force each channel into 8-bits with ImageMagick or is this simply not possible?

Re: Increase Bits Per Channel

Posted: 2016-04-10T17:05:54-07:00
by snibgo
Have you tried saving as PNG24 format, eg PNG24:x.png ?

Re: Increase Bits Per Channel

Posted: 2016-04-10T17:22:22-07:00
by Bighead
I tried PNG24 and some images came out black, but trying just PNG32 seems to work perfect because the images load into the game! The channel depths are the same as before, but I guess it doesn't matter after all (told you I don't know that much). As long as they work that's all that matters. :) I guess it was just a problem with the images...