PNG Image Cropper

At FOTB Brighton I presented on our process for developing the Fairies and Dragons Happy Meal toys. One of the things I showed was how we took a png sequence exported from Maya and cropped them to reduce the amount of alpha. To do that I built a WPF application in C# that would look at a folder and read in every png that was in there. For every image the application runs through each pixel and tries to determine all of the unnecessary alpha and crops it. The cool thing is that when the file gets saved out again it saves it with the x,y offset in the filename so that we can use a JSFL script to import all the images so the animation lines up.

Here is an example. Note : Everything in red is actually alpha I just filled it in for demonstration purposes.

Image Cropper

First select a input folder. This folder would have all of your images are in. Make sure the images are named sequentially.
Next select a output folder. It’s best if this folder is empty as this will be the folder where all of the cropped images will be placed.

Original Image

Here is a sample of the original image named Animation_Test.1.jpg.

Cropped Image

Here is the cropped image with the new name Animation_Test.1._163_95.jpg
As you can see it appends the x,y offset to the end of the filename ( 163, 95 ).

The final step is to run the JSFL command included with the application.

Select an empty layer on a timeline and run the command. It will prompt you to select a file from your output folder. Don’t worry which file it is because it is simply getting the folder not the file path. Flash will now import each image in the folder to a new keyframe and position the image at the x,y offset in the filename – in this case 163,95.

Feel free to download the application and give it a try.
You’ll need to have .NET 3 Framework installed for the application to run.

Continue reading » · Rating: · Written on: 10-28-08 · 4 Comments »