Sto cercando di creare un jpeg progressivo da un oggetto UIImage
, questo è il codice che stoCreazione jpeg progressivo su iOS con ImageIO produce risultati a blocchi su dispositivo
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);
Questa grande opera durante l'esecuzione in simulatore , ma purtroppo produce risultati grosso/a blocchi sul dispositivo:
tutte le idee su quello che sta succedendo? tornerei a utilizzare UIImageJPEGRepresentation
come ultima risorsa, ho davvero bisogno di JPEG progressivi.
qual è la versione iOS? – Raptor
@ShivanRaptor è stato testato con iOS 5.0 - 5.1.1 –
Sto provando a testare i codici con il mio telefono. Puoi condividere anche il 'test.jpg' che stai utilizzando? – Raptor