Ich versuche produziert, das ist der Code iErstellen progressive JPEG auf iOS mit ImageIO blocky Ergebnisse auf dem Gerät eine progressive JPEG von einem <code>UIImage</code> Objekt zu erstellen
binNSMutableData *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);
Dies funktioniert gut, wenn in Simulator läuft , produziert aber leider klobig/blocky Ergebnisse auf dem Gerät:
Irgendwelche Ideen auf, was los ist? Ich würde wieder auf UIImageJPEGRepresentation
als letztes Mittel zurückgreifen, ich brauche wirklich progressive JPEGs.
Was ist die iOS-Version? – Raptor
@ShivanRaptor wurde mit iOS 5.0 - 5.1.1 getestet –
Ich versuche, die Codes mit meinem Handy zu testen. Kannst du auch das 'test.jpg' teilen, das du benutzt? – Raptor