It is an interesting task to get a pixelated image from the original photo-realistic image (UIImage - CGImage - ...). That is, for example, there is an image, and it is necessary to split it into a pixel grid. The main question is how to determine the color of the image in each pixel and recalculate it, so that after converting this color to a fixed monophonic (RGB) image, the image will be adequate to the original image.

The task seems to be quite complex and its solution may be ambiguous. I will be glad to any sensible comments on this topic.

Thank!

  • one
    the average between the colors of the 8 surrounding pixels, add up all X, divide by 8, Add O, divide by 2 ... XXX XOX XXX I think this will be true - Vladimir Klykov
  • Not sure if I understood you correctly. Initially, there is a photorealistic image (so it will probably be more understandable to explain), so if you conditionally divide it into pixels, then in each particular pixel there will be a whole gamma, consisting of different shades. How to find the average color of each pixel and replace it with a single color (rgb) so that after this transformation the overall appearance of the image is preserved - AlexThumb
  • 2
    You have a bad idea of ​​a pixel, a pixel has 3 color components and the intensity of each of the 3 primary colors (in the case of rgb-red, green, blue, 0-FF for each color (read the description of the bmp format, it is the simplest and most understandable)) ... - Vladimir Klykov
  • one
    And scaling (from a heap of pixels, from a huge photo, get under the screen size), following the example from my first comment (it is simplified there), but in the end each pixel has only 1 visible color consisting of 3 (4) main ones .. - Vladimir Klykov
  • Thank you for your comment, I will understand! - AlexThumb

1 answer 1

As it turned out, the task (as well as the mass of related ones) is solved by the GPUImage library. I highly recommend it when you need quick and easy work with transformation and image filters.