updated for proper image compression