Although the current packing algorithm is OK, we need to improve it to make it even better.
Currently, the algorithm uses X and Y scanlines that radiate out from (0, 0). It checks the X scanline first, and then it checks the Y scanline. It should instead find and store the first place found on both axes, and pick best one out of the two.
Here's an example packing result:
It might be worth noting that normally, you wouldn't give it so many different awkwards shapes.
It might also be worth noting that the algorithm hasn't been check to make sure it handles non-square images correctly. Some of the placement errors may have occurred due to the fact that the input images were not square.