resize for not only jpg but also png.