Closed iDevid closed 4 years ago
You could test it out with this image:
Thanks for issuing me. I found the problem.
To process an image, we need the metal texture of the image. We use MTKTextureLoader
and CGImage
to get the metal texture. When the test image is a general project file, the color space of CGImage is RGB. However, when the test image is under the Asset folder, the color space becomes Monochrome. MTKTextureLoader can not decode image for Monochrome color space. So we can not get the metal texture of the image. The similar problem can be found here.
To solve the problem:
CGContext
with device RGB color space, draw the CGImage, and get the bitmap dataI will fix it in the next version.
Version 1.0.1 fixes it.
Image Quality seems very bad, the same Filter trough CIFilter is very much better. You can see in the demo, that if you apply the filter on this type of images, they become shelled.
I have not reproduced the bad quality problem. Could you please show me the code? It will help me if there is a simple demo.
I test BBMetalColorMatrixFilter
and CIFilter
with CIColorMatrix
. It is true that they are different, and monochrome image becomes shelled after apply BBMetalColorMatrixFilter
. But I can not tell which filter gets good or bad image quality. I also test GPUImageColorMatrixFilter
(famous GPUImage framework). It has the same result as BBMetalColorMatrixFilter
, making monochrome image shelled. Maybe CIColorMatrix
uses different shader, or contains more image processing steps.
I tried to create a filteredImage from an image, but it returns nil. The strange thing is that this image is under the Assets folder, If I move it in the general projects file, the filter then works.
Have you any idea?