I have original image and I can cycle all pixels using @patrick-rutkowski answer here. Also I have this answer seems to create image with pixel data. But I can't understand how to combine these two answers. So the first task is get pixel and second is add it to another CGImage. For example if I want to extract all red pixels from the original image and add these red pixels to another image. I suppose it's way to go.
Create new image using just some pixels data from the source image based on them color
Asked Answered
Can you clarify what you are trying to achieve? –
Ruffin
@nschmidt. I have one image with different colors. Let's say it is source image. I want to create new one image but only with pixels that I extracted from the source image e.g. if I need to extract only red pixels or blue pixels and create new images based on this pixels. –
Unifilar
@Ruffin here is also answer how to create pixels. –
Unifilar
@nschmidt. So let's say I have image 50 x 100 then I will have Byte r[100][50] and the same for g and b. Then I will use your example to add alpha channel. So I need some cycle where I can track all pixels and compare them with some color for example red. Then I need to save a position of the red pixel and draw it the output image. If pixel is not the red I will add transparent pixel on that place. But this is just idea. I want to know how can I cycle source image pixels and compare it with some color and then create output image based on condition I described. –
Unifilar
© 2022 - 2024 — McMap. All rights reserved.