RSS/Atom feed Twitter
Site is read-only, email is disabled

Reduceing colors in the Alpha layer

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

7 of 7 messages available
Toggle history

Please log in to manage your subscriptions.

Reduceing colors in the Alpha layer Lord_Garland 15 Dec 14:33
  Reduceing colors in the Alpha layer David Gowers 16 Dec 04:32
   Reduceing colors in the Alpha layer Francois du Toit 17 Dec 09:35
    Reduceing colors in the Alpha layer Lord_Garland 17 Dec 10:18
     Reduceing colors in the Alpha layer David Gowers 17 Dec 23:50
    Reduceing colors in the Alpha layer Sven Neumann 20 Dec 21:18
     Reduceing colors in the Alpha layer Lord_Garland 22 Dec 14:32
2008-12-15 14:33:26 UTC (over 15 years ago)
postings
3

Reduceing colors in the Alpha layer

I have a problem. I am making flash games but there is a 10 meg limit on the total size of the game I can make. In order to do what I want i need to compress my sprites as much as can be done. I am using PNG files.

I have in the past I have reduced the number of colors and removed the alpha layer and used only one transparent color.

What I want to do now is reduce the number of colors like before but also use a alpha layer. This reduction of colors really helps reduce the size of the sprite and after I put it though PingOUT I really get a smaller size. However I want to reduce the number of colors in the alpha layer and keep the color set to RGB. I've been using the index color option and then set it back to RGB color. This works file for the picture but it does nothing to the alpha layer. I have tried using posterize on the alpha layer. It does reduce the total file size but not by much. In the past I have found that postersize does not reduce the number of colors saved in the index. It only makes it look like there are fewer colors. I have tested this much and it does store many colors many of which are the same.

I have tried my best to reduce the number of colors in the alpha layer but to no luck. If I could reduce the number of alpha colors I could really make a good looking sprites for my game.

File size is a big deal, while at the same time I want to have some sort of alpha layer. Even if it doesn't have all the colors it would have normally.

I have been using gimp 2.2. I am getting the new version now.

Sorry for the long post.

David Gowers
2008-12-16 04:32:46 UTC (over 15 years ago)

Reduceing colors in the Alpha layer

Hello,

On Tue, Dec 16, 2008 at 12:03 AM, Andrew R. wrote:

I have a problem. I am making flash games but there is a 10 meg limit on the total size of the game I can make. In order to do what I want i need to compress my sprites as much as can be done. I am using PNG files.

I have in the past I have reduced the number of colors and removed the alpha layer and used only one transparent color.

What I want to do now is reduce the number of colors like before but also use a alpha layer. This reduction of colors really helps reduce the size of the sprite and after I put it though PingOUT I really get a smaller size. However I want to reduce the number of colors in the alpha layer and keep the color set to RGB. I've been using the index color option and then set it back to RGB color. This works file for the picture but it does nothing to the alpha layer. I have tried using posterize on the alpha layer. It does reduce the total file size but not by much. In the past I have found that postersize does not reduce the number of colors saved in the index. It only makes it look like there are fewer colors. I have tested this much and it does store many colors many of which are the same.

I have tried my best to reduce the number of colors in the alpha layer but to no luck. If I could reduce the number of alpha colors I could really make a good looking sprites for my game.

This is pretty easy.

For binary dithering of the alpha channel: 1. There is an option 'dither transparency' when converting to indexed which will dither the alpha channel.

For dithering or quantizing the alpha channel to N levels: 1. Add a layer mask with the option 'transfer layer's alpha channel' 2. Copy and paste it as a new image, 3. Indexize it to N colors (with or without positioned dithering, at your option)
4. copy it and paste it back on the original layermask 5. apply the layer mask

PNG actually supports indexed images with full 8bit alpha channel. If Flash supports that, it could be worth your while to look into.

David

Francois du Toit
2008-12-17 09:35:25 UTC (over 15 years ago)

Reduceing colors in the Alpha layer

On Tue, Dec 16, 2008 at 5:32 AM, David Gowers wrote:

PNG actually supports indexed images with full 8bit alpha channel. If Flash supports that, it could be worth your while to look into.

But does gimp support indexed images with full 8bit alpha channel? Converting an image to indexed also converts the alpha channel to 1bit in some quick tests.

2008-12-17 10:18:27 UTC (over 15 years ago)
postings
3

Reduceing colors in the Alpha layer

Yes it does that but only to 1-bit. I want the colors reduced to a few colors. If I transfer the alpha layer to a channel in the layers section I can save the alpha layer. It can then be exported with the image as a PNG. However, I've found no way of reducing the number of colors in the alpha layer.

Thank you for your time.

David Gowers
2008-12-17 23:50:12 UTC (over 15 years ago)

Reduceing colors in the Alpha layer

On Wed, Dec 17, 2008 at 7:48 PM, Andrew R. wrote:

Yes it does that but only to 1-bit. I want the colors reduced to a few colors. If I transfer the alpha layer to a channel in the layers section I can save the alpha layer. It can then be exported with the image as a PNG. However, I've found no way of reducing the number of colors in the alpha layer.

I just told you one.
It's true that GIMP doesn't know how to save indexed PNG with alpha channel, you'll need a plugin or some other program to do that (after saving as RGBA png); However the method I described is perfectly effective at performing the reduction.

David

Sven Neumann
2008-12-20 21:18:36 UTC (over 15 years ago)

Reduceing colors in the Alpha layer

Hi,

On Wed, 2008-12-17 at 10:35 +0200, Francois du Toit wrote:

On Tue, Dec 16, 2008 at 5:32 AM, David Gowers wrote:

PNG actually supports indexed images with full 8bit alpha channel. If Flash supports that, it could be worth your while to look into.

But does gimp support indexed images with full 8bit alpha channel?

Yes, it does. With some caveats (see below).

Converting an image to indexed also converts the alpha channel to 1bit in some quick tests.

That observation is wrong. It's just the display that shows the image as if the alpha channel only had 1 bit. This is a historical decision, made to make it easier to work with GIF files. The alpha channel is actually kept intact. The PNG save plug-in does not support saving indexed images with full 8bit alpha channel though. If you really need this feature, it shouldn't be too difficult to improve support for it in GIMP. Perhaps start by changing the PNG plug-in...

Sven

2008-12-22 14:32:27 UTC (over 15 years ago)
postings
3

Reduceing colors in the Alpha layer

How do I change the png plug in?

Hi,

On Wed, 2008-12-17 at 10:35 +0200, Francois du Toit wrote:

On Tue, Dec 16, 2008 at 5:32 AM, David Gowers wrote:

PNG actually supports indexed images with full 8bit alpha channel. If Flash supports that, it could be worth your while to look into.

But does gimp support indexed images with full 8bit alpha channel?

Yes, it does. With some caveats (see below).

Converting an image to indexed also converts the alpha channel to 1bit in some quick tests.

That observation is wrong. It's just the display that shows the image as if the alpha channel only had 1 bit. This is a historical decision, made to make it easier to work with GIF files. The alpha channel is actually kept intact. The PNG save plug-in does not support saving indexed images with full 8bit alpha channel though. If you really need this feature, it shouldn't be too difficult to improve support for it in GIMP. Perhaps start by changing the PNG plug-in...

Sven