image orientation and sizes ratio detection