enter image description here

I want to be able to quickly outline sprites(mainly with black, but other colours too) without doing it manually, as pictured. What would be a good program/solution to do so?

Edit: I don't want it to happen at runtime, I just want to have the second version and I can scrap the first.

  • \$\begingroup\$ This is a common image processing problem with various algorithms imageprocessingplace.com/downloads_V3/root_downloads/tutorials/… \$\endgroup\$
    – concept3d
    Nov 6, 2014 at 14:02
  • 2
    \$\begingroup\$ Sounds like a lot of processing for something that could be done very easily when creating the sprites for no additional processing. \$\endgroup\$
    – Shroeder
    Nov 6, 2014 at 15:35
  • \$\begingroup\$ What do you mean, "very easily"? I need some sort of automated process. \$\endgroup\$ Nov 8, 2014 at 15:44

1 Answer 1


it's trivial, you can do it yourself. Assuming your sprites have alpha value 0 in unused areas, you can do the following (in pseudocode):

pixels_out = pixels
for y in pixels.height()
    for x in pixels.width()
        if pixels(x,y).alpha == 0,
            neighbour_in_sprite = false
            for y2 in [-1,0,1]
                for x2 in [-1,0,1]
                    if pixels(x+x2,y+y2).alpha > 0
                        neighbour_in_sprite = true
                if neighbour_in_sprite
            if neighbour_in_sprite
                pixels_out(x,y).color = [0,0,0]
                pixels_out(x,y).alpha = 255

It's pretty much, for every unused pixel in the 8-neighbourhood of a used pixel, mark it as silhouette and set the black colour and normal alpha .


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .