I’ve been playing with graphics.newOutline() quite a bit recently, and have found some oddities and tips I figured I’d pass along:
I found that unless I use an image that is completely white, the outline that is produced is unpredictable. If I use a non-white image, I sometimes get an outline that is the bounding box of the entire image, or sometimes an outline that is just a small square. The documentation says the newOutline() works by detecting non-transparent alpha pixels, but I’ve found that the image needs to be pure white on an alpha background. Even the orange star image in the original tutorial doesn’t work for me. It’s probably not a coincidence that the star image used in the samples directory is pure white.
The larger the image I use for the outline, the more unpredictable the results. Sometimes I get holes in the outline. A trick I found is to use a smaller image for the outline, while using the full-size image for the actual display object. For instance, if the image for my display object is 512x256, then I will create a pure-white version of my image at 128x64, and use this white, smaller image to generate the outline. Then, I simply iterate through the vertices in the outline and multiply every coordinate by 4 before I turn my display object into a physics body with the outline.