Quiero crear la miniatura usando el CG. Crea las miniaturas.CGImage crear imagen en miniatura con el tamaño deseado
Aquí quiero tener la miniatura con el tamaño 1024 (con relación de aspecto). ¿Es posible obtener la miniatura del tamaño deseado directamente desde el CG?
En el diccionario de opciones puedo pasar el tamaño máximo del thumnail se puede crear, pero ¿hay alguna manera de tener un tamaño mínimo para el mismo ...?
NSURL * url = [NSURL fileURLWithPath:inPath];
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
CGImageRef image=nil;
if (source)
{
NSDictionary* thumbOpts = [NSDictionary dictionaryWithObjectsAndKeys:
(id) kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailWithTransform,
(id)kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailFromImageIfAbsent,
[NSNumber numberWithInt:2048], kCGImageSourceThumbnailMaxPixelSize,
nil];
image = CGImageSourceCreateThumbnailAtIndex(source, 0, (CFDictionaryRef)thumbOpts);
NSLog(@"image width = %d %d", CGImageGetWidth(image), CGImageGetHeight(image));
CFRelease(source);
}