07-16-2024, 03:34 AM
(07-12-2023, 07:01 AM)Ofnuts Wrote: The Color erase mode computes the most transparent pixel under which you can stack the erased color to rebuild the initial color. For instance, yif you Color-erase a purple pixel with red, you are left with a partially transparent blue, and if you put this pixel over the erase red, you get the purple back.
In your case the result of the posterization is used as a temporary/virtual color-erase layer. If you had an infinite level of posterization, the posterized image would be identical to the source image, and all pixels would be color-erased by a copy of themselves and would turn fully transparent. With normal posterization levels, you color-erase pixels with whatever color the posterization would color them into, which is fairly random because that depends on the rest f the image and the posterization levels.... The only not-too-random part of the result is that since the pixel is replaced by the closest color in the posterization set it will be likely quite transparent. But since you throw away the alpha channel all you see is the residual color, which v very transparent pixels is not that accurate so you have a bit of randomness here too, especially in 8bpc mode.
IMHO you would get very similar results, by 1) color-indexing the image, and 2) assigning random values in the color map.
First of all, thank you Ofnuts for your input. It's been a while since I attempted this project. I have nearly succeeded at my process of replicating the desired posterize + color-erase effect using python, numpy, and PIL. I am currently hung up on replicating the exact output of my gimp process.
I am only making a new post here because I am pretty stuck. Seems I may have missed some subtle nature of gimp that could be affecting gimp's output versus my limited understanding of the process.
I have theorized that it could be something to do any or none of these processes:
- The blending of the images
- the alpha calculation for the color-erase
- A default palette or preset within gimp that produces the particular color combination.
Example:
Gimp posterize with 2 levels using color-erase blending option:
Python replication of gimp 2.10 posterize and color erase algorithm:
Original image:
If more information is necessary please let me know. I'm appreciative and open to any suggestions on how I can solve this issue.