当我将这些代码添加到我的应用程序中时显示kMESImageQuality上的错误

时间:2014-03-11 05:18:57

标签: objective-c

UIImage * originalImage = [info valueForKey:UIImagePickerControllerOriginalImage];

NSData  *imageData    = UIImageJPEGRepresentation(originalImage, kMESImageQuality);
double   factor       = 1.0;
double   adjustment   = 1.0 / sqrt(2.0);  // or use 0.8 or whatever you want
CGSize   size         = originalImage.size;
CGSize   currentSize  = size;
UIImage *currentImage = originalImage;

while (imageData.length >= (1024 * 1024))
{
    factor      *= adjustment;
    currentSize  = CGSizeMake(roundf(size.width * factor), roundf(size.height * factor));
    currentImage = [originalImage resizedImage:currentSize interpolationQuality:kMESImageQuality];
    imageData    = UIImageJPEGRepresentation(currentImage, kMESImageQuality);
}

1 个答案:

答案 0 :(得分:0)

好像你没有定义'kMESImageQuality'。为'kMESImageQuality'

定义一个值