UIImage *img = imgView.image;
int h = img.size.height;
int w = img.size.width;
if(h <= 320 && w <= 480)
{
imgView.image = img;
}
else
{
float b = (float)320/w < (float)480/h ? (float)320/w : (float)480/h;
CGSize itemSize = CGSizeMake(b*w, b*h);
UIGraphicsBeginImageContext(itemSize);
CGRect imageRect = CGRectMake(0, 0, b*w, b*h);
[img drawInRect:imageRect];
imgView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}