use Image lib to calculate image dimension instead of shell call on ImageMagic