Tworzenie progresywnego pliku jpeg na iOS z ImageIO powoduje blokowanie wyników na urządzeniu
Próbuję stworzyć progresywny jpeg z aUIImage
obiekt, to jest kod, którym jestem
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);
Działa to doskonale podczas uruchamiania w symulatorze, ale niestety powoduje powstawanie masywnych / blokowych wyników na urządzeniu:
Jakieś pomysły na to, co się dzieje? powróciłbym do używaniaUIImageJPEGRepresentation
w ostateczności naprawdę potrzebuję progresywnych plików JPEG.