Is programmatically inverting the colors of an image possible?

后端 未结 7 1898
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 07:00

I want to take an image and invert the colors in iOS.

7条回答
  •  我在风中等你
    2020-11-28 07:38

    Tommy answer is THE answer but I'd like to point out that could be a really intense and time consuming task for bigger images. There two frameworks that could help you in manipulating images:

    1. CoreImage
    2. Accelerator

      And it really worth to mention the amazing GPUImage framework from Brad Larson, GPUImage makes the routines run on the GPU using custom fragment shader in OpenGlES 2.0 environment, with remarkable speed improvement. With CoreImge if a negative filter is available you can choose CPU or GPU, using Accelerator all routines run on CPU but using vector math image processing.

提交回复
热议问题