Sprite masking with alpha channels in GraphicsGale (edit: added Python + Pillow script)

Edit: I made a quick-and-dirty Python 3 / Pillow script for applying color key-style alpha channel masks, it can be grabbed here.

I’ve been messing around with Kivy lately, and it seems that there is not a direct method of doing color key transparency in Kivy + OpenGL. No problem: alpha transparency is much more powerful and can be used for my archaic purposes.

blog-transparency

I haven’t worked much with alpha channels in the art package that I use, GraphicsGale. The best solution is probably to loop through the pixels of the texture upon loading or refreshing it in your program, and apply alpha if the color key RGB is detected. In any case, here is how to apply an alpha channel in a color key stencil fashion to 24bpp Full Color PNGs in GraphicsGale:

  • Choose the color picker tool (blue square with a yellow oval) and click on an empty / transparent space in your sprite sheet.

sprite-alpha2

  • Choose View -> Make Alpha Channel…
  • Create From: Current Selection
  • Source: (should be the current file — double check)
  • Check Invert Selection and click OK.
  • When you save the file, use Save As… and ensure that “With Alpha Channel” is checked.

You should now have a stencil alpha layer which you can toggle in GraphicsGale with the “a” button on the current layer. If you’ve tweaked art and need to remake the alpha layer, goto Image -> Delete Alpha Channel and then repeat the steps above.

 

Links

  • Alpha channel notes from an artist working with GraphicsGale and Adventure Game Studio. His example images have expired, unfortunately, but there is some interesting info about drawing in Opacity Mode.

 

(e 23/Oct/2018: Just a quick addendum to note that the GraphicsGale Alpha channel dialog box doesn’t seem to work properly when running under Wine (3.17). In this case, Pillow can be used to generate a sprite mask on the alpha channel.)

1 Comment

Leave a Comment

Your email address will not be published. Required fields are marked *