在CGImageDestinationRef苹果参考文献中提到:
我想要添加一个缩略图(或直接从
上面的代码返回拥有缩略图的图像的缩略图,但是当我通过
是否有一些方法可以保留原始缩略图(或创建新的缩略图)? CGImageProperties Reference似乎没有任何可以存储缩略图的键。
它可以包含缩略图像以及每个图像的属性。
通过在添加图像到CGImageDestinationRef
时设置properties
参数,属性部分运作良好,但我无法弄清如何添加缩略图。我想要添加一个缩略图(或直接从
CGImageSourceRef
传递它)到CGImageDestinationRef
,这样当使用CGImageSourceRef
打开生成的图像时,我可以使用CGImageSourceCreateThumbnailAtIndex
检索原始缩略图。NSDictionary* thumbOpts = [NSDictionary dictionaryWithObjectsAndKeys:
(id)kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailWithTransform,
(id)kCFBooleanFalse, (id)kCGImageSourceCreateThumbnailFromImageIfAbsent,
[NSNumber numberWithInt:128], (id)kCGImageSourceThumbnailMaxPixelSize,
nil];
CGImageRef thumb = CGImageSourceCreateThumbnailAtIndex(iSource, 0, (CFDictionaryRef)thumbOpts);
上面的代码返回拥有缩略图的图像的缩略图,但是当我通过
CGImageDestinationRef
传递图像时,缩略图丢失了。是否有一些方法可以保留原始缩略图(或创建新的缩略图)? CGImageProperties Reference似乎没有任何可以存储缩略图的键。
CGImageDestinationRef
中设置缩略图。 - alex-i