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.