IOS圖片壓縮

weixin_33749242發表於2016-09-03
NSData *pdata = UIImageJPEGRepresentation(pImage, 1);

  pData = UIImageJPEGRepresentation(pImage, 1);
    CGFloat pSize = [pData length]/(1024*1024);

    if ( pSize <1) {
        [pData writeToFile:TMP_IMG atomically:YES];
    }else{
        pData = UIImageJPEGRepresentation(pImage, 1/(pSize+0.5));
        [pData writeToFile:TMP_IMG atomically:YES];
    }

相關文章