Determines the best compression for an image