La creación de archivos JPEG progresivos en iOS con ImageIO produce resultados en bloque en el dispositivo
Estoy tratando de crear un jpeg progresivo de unaUIImage
objeto, este es el código que soy
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);
Esto funciona muy bien cuando se ejecuta en un simulador, pero desafortunadamente produce resultados gruesos / en bloques en el dispositivo:
¿Alguna idea sobre lo que está pasando? volvería a usarUIImageJPEGRepresentation
Como último recurso, realmente necesito archivos JPEG progresivos.