にブロック状の結果を生成し、これは私がシミュレータで実行しているときにこれは素晴らしい作品はImageIOにとiOSのプログレッシブJPEGを作成する私は<code>UIImage</code>オブジェクトからプログレッシブJPEGを作成しようとしているデバイス
NSMutableData *data = [NSMutableData data];
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent: @"Library/Caches/test.jpg"];
CFURLRef url = CFURLCreateWithString(NULL, (CFStringRef)[NSString stringWithFormat:@"file://%@", path], NULL);
CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypeJPEG, 1, NULL);
CFRelease(url);
NSDictionary *jfifProperties = [NSDictionary dictionaryWithObjectsAndKeys:
(__bridge id)kCFBooleanTrue, kCGImagePropertyJFIFIsProgressive,
nil];
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:.7], kCGImageDestinationLossyCompressionQuality,
jfifProperties, kCGImagePropertyJFIFDictionary,
nil];
CGImageDestinationAddImage(destination, ((UIImage*)object).CGImage, (__bridge CFDictionaryRef)properties);
CGImageDestinationFinalize(destination);
CFRelease(destination);
だコードですが、残念ながら、デバイス上の分厚い/ブロック状の結果生成します。何が起こっているのに
任意のアイデア?私は最後の手段としてUIImageJPEGRepresentation
を使用することに戻りたいと思います。私は本当にプログレッシブJPEGが必要です。
iOSのバージョンは何ですか? – Raptor
@ShivanRaptor iOS 5.0 - 5.1.1でテストされています –
私の電話でコードをテストしようとしています。あなたが使っている 'test.jpg'も共有できますか? – Raptor