Added trim.
Added inner padding. (Issue #21)
Added more error checking.
Updated sort logic to use frame dimensions when available, image dimensions otherwise.
Basic packer uses (likely post-processed) frame dimensions rather than image dimensions.