【问题标题】:How to create GIF (which looks more natural) with dithering from video frames or Array of UIImages?如何通过视频帧或 UIImages 数组的抖动创建 GIF(看起来更自然)?
【发布时间】:2021-07-29 18:37:32
【问题描述】:

这是链接 (https://imgplay.zendesk.com/hc/en-us/articles/360029411991-What-is-GIF-Dithering-Option-),上面写着When you save the file as GIF with dithering, it can make your GIF more natural.

如何使用 Objective-C 或 Swift 实现 Dithering 以从 UIImage 或视频帧创建更自然的 GIF?

【问题讨论】:

标签: ios swift objective-c core-image dithering


【解决方案1】:

假设您的源图像是每通道 8 位 RGB,您可以使用 vImage。 vImage 没有vImageConvert_RGB88toIndexed8,但您可以将交错图像拆分为三个用于 RGB 的 8 位平面缓冲区。我不知道这到底有多好,但您可以将三个通道中的两个转换为Indexed2vImageConvert_Planar8toIndexed2,另一个通道转换为Indexed4vImageConvert_Planar8toIndexed4。这将为您提供所需的 8 位查找表。

Apple 有大量 Accelerate 示例代码项目 hereOptimising Image-Processing Performance 讨论将交错图像转换为平面格式。如果您有已知的调色板,Applying Color Transforms to Images with a Multidimensional Lookup Table 可能是将您的图像量化为 256 色的解决方案。

【讨论】:

  • 我是 viImage 的新手。即使我没有对 vImage 做任何事情。你能举个例子吗?如何将图像拆分为 3 位规划器缓冲区以及如何使用您提供的其他功能?感谢您的时间和宝贵的参考资料。 @simon-gladman
  • 嗨@sagarthecoder,我已将指向 Apple 文档的链接添加到我的答案中。
  • vImageConvert_Planar8toIndexed2(argbSourcePlanarBuffers[1], argbDestinationPlanarBuffers[1], kvImageGetTempBufferSize, lookUpTable, kvImageConvert_DitherFloydSteinberg, kvImageNoFlags) 它总是显示Type of expression is ambiguous without more context
  • 您需要添加更多信息 - 您的参数是什么类型?你看过文档 (developer.apple.com/documentation/accelerate/…) 吗?
  • ...您可能想提出一个标记为 [vimage] 的新帖子。
猜你喜欢
  • 1970-01-01
  • 2016-01-06
  • 1970-01-01
  • 2021-06-08
  • 1970-01-01
  • 1970-01-01
  • 2016-12-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多