added support to compressing images