The file command should give you size. Simply parse it out of the output and calculate arguments to the convert command You can also use convert to resize by percent. That will not throw off the image.