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

Flatten image into image and alpha

This discussion is connected to the gimp-developer-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.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Flatten image into image and alpha Andreas Henriksson 09 May 17:57
  Flatten image into image and alpha Tino Schwarze 09 May 19:02
   Flatten image into image and alpha Andreas Henriksson 10 May 20:00
    Flatten image into image and alpha Tino Schwarze 10 May 20:39
Flatten image into image and alpha saulgoode@brickfilms.com 11 May 08:18
Andreas Henriksson
2006-05-09 17:57:30 UTC (almost 18 years ago)

Flatten image into image and alpha

Hello

Looking through the API specifications, I can't find a good way to flatten an image into image and alpha. I'm trying to make a save plugin for the Nintendo DS's texture formats, there is a list of them at http://dualis.1emulation.com/dsti.html#lcdioteximgparam . What I really want to do is probably to extract the alpha data, flatten the image, convert the image to indexed, convert the alpha, then apply the alpha again for preview. Unfortunately, I'm unable to figure out how to perform the two last steps. The best format for the extracted alpha would be an array, or a format that allows you to access the data. I think I will do bitshifting on that, unless you guys think it's a bad way to scale it down.

Thanks Andreas Henriksson

Tino Schwarze
2006-05-09 19:02:10 UTC (almost 18 years ago)

Flatten image into image and alpha

Hi Andreas,

On Tue, May 09, 2006 at 05:57:30PM +0200, Andreas Henriksson wrote:

Looking through the API specifications, I can't find a good way to flatten an image into image and alpha. I'm trying to make a save plugin for the Nintendo DS's texture formats, there is a list of them at http://dualis.1emulation.com/dsti.html#lcdioteximgparam . What I really want to do is probably to extract the alpha data, flatten the image, convert the image to indexed, convert the alpha, then apply the alpha again for preview.

What do you mean by "apply the alpha again for preview"? You could also "merge visible layers" which preserves the alpha channel. Then you only need to remove invisible layers and may convert to indexed with up to 255 colors, so you get 1 bit alpha.

HTH,

Tino.

Andreas Henriksson
2006-05-10 20:00:58 UTC (almost 18 years ago)

Flatten image into image and alpha

Thank you for your answer

On 5/9/06, Tino Schwarze wrote:

What do you mean by "apply the alpha again for preview"?

I want radio boxes with the ability to choose between the different texture formats, and a preview thing to see which looks best, so at first, I don't do the entire conversation, just enough to make Gimp help me show what it will look like.

You could also

"merge visible layers" which preserves the alpha channel. Then you only need to remove invisible layers and may convert to indexed with up to 255 colors, so you get 1 bit alpha.

The problem is that I don't want 1 bit of alpha all the time, it depends on the format. One has 5 bits, one has 3 and a couple of them have none.

Andreas

Tino Schwarze
2006-05-10 20:39:05 UTC (almost 18 years ago)

Flatten image into image and alpha

Hi Andreas,

On Wed, May 10, 2006 at 08:00:58PM +0200, Andreas Henriksson wrote:

What do you mean by "apply the alpha again for preview"?

I want radio boxes with the ability to choose between the different texture formats, and a preview thing to see which looks best, so at first, I don't do the entire conversation, just enough to make Gimp help me show what it will look like.

You could also
"merge visible layers" which preserves the alpha channel. Then you only need to remove invisible layers and may convert to indexed with up to 255 colors, so you get 1 bit alpha.

The problem is that I don't want 1 bit of alpha all the time, it depends on the format. One has 5 bits, one has 3 and a couple of them have none.

Then I can't help you - looks like core developer issue (I'm more of an experienced user).

Bye,

Tino.

saulgoode@brickfilms.com
2006-05-11 08:18:09 UTC (almost 18 years ago)

Flatten image into image and alpha

I believe you can do what you describe (if I understand correctly) using just the current PDB. You will have to convert your image to Indexed Mode and then back to RGB in order to create the previews (as Andreas stated, you can only have 1-bit alpha when using using the GIMP's Indexed Mode).

Below you will find a link to a short Script-fu which I think provides close to what you want (or perhaps you might just otherwise gain some inspiration from it). You will have to provide your own code to save the Indexed version and the resulting layer mask (which is the N-bit Alpha channel), as well as create any miniaturized previews; the script is merely intended for demonstration of a technique.

http://www.postbrickfilms.com/saulgoode/GIMP/Scripts/alpha-preview.scm