Increase Bits Per Channel

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Increase Bits Per Channel

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Increase Bits Per Channel

Post 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.
snibgo's IM pages: im.snibgo.com
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Re: Increase Bits Per Channel

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Increase Bits Per Channel

Post by snibgo »

Have you tried saving as PNG24 format, eg PNG24:x.png ?
snibgo's IM pages: im.snibgo.com
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Re: Increase Bits Per Channel

Post 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...
Post Reply