CGFloat aspectRatioX = imageView.bounds.size.width/imageView.image.size.width;
CGFloat aspectRatioY = imageView.bounds.size.height/imageView.image.size.height;
if ( aspectRatioX < aspectRatioY )
imageRect = CGRectMake(0, (imageView.bounds.size.height - aspectRatioX*imageView.image.size.height)*0.5f, imageView.bounds.size.width, aspectRatioX*imageView.image.size.height);
else
imageRect = CGRectMake((imageView.bounds.size.width - aspectRatioY*imageView.image.size.width)*0.5f, 0, aspectRatioY*imageView.image.size.width, imageView.bounds.size.height);