06-17-2022, 01:34 PM
I am trying to draw/paint with only 4 gray shades on top of a black background. I am then exporting the drawing to a file that is read into Python with the PIL library (for image processing) as an image mask. When the file created in GIMP is read into Python, a quick look at the values associated with the palette indicates about 20 values. I'm only expecting five values, the background and four gray values, and not sure why this is happening. I think it possibly has to do with pixels that are not one of the shades I'm trying to stick to in the drawing, what I consider noise. I don't have much graphics background, so I may not have the language I need to describe my problem.
My workflow is:
1. Add a new layer over a camera image I'm working with. The new layer has a black background, the HTML notation is 000000. Call it "next".
2. I select the next layer, turn off its visibility to see the camera image with AOIs (Area Of Interest).
3. I use the paths tool to trace the outline of an AOI on next layer. I modify the paths to fit the AOI best I can.
4. I stroke the path to finish that AOI. I use a white color to stroke the paths.
5. I repeat 3 and 4. I have 4 AOIs in each camera image I'm working with.
6. I pick one of HTML notation colors 030303, 070707, 0b0b0b, or 0e0e0e as bucket fill for inside of each AOI.
7. I change the zoom to 200 or 400% to get a good look at the white outline of each AOI. I pick the respective gray per AOI and color over the white outline to make the whole AOI just one shade and get rid of white.
8. I change the mode of the layer to Grayscale in the Image menu.
9. In Layer>Transparency> Remove Alpha Channel
10. I export to PNG and save as 8bpc Gray with no background color.
I import the PNG to Python and then find that there are 16-20 values in the image.
I've attached an example of one of the next images. It's hard to see one of the AOIs because the 030303 is hard to tell from 000000, but you can see that AOIs get darker from one end to the other.
Is there a way to make sure that I'm just getting the background and the four AOI shades in the PNG?
My workflow is:
1. Add a new layer over a camera image I'm working with. The new layer has a black background, the HTML notation is 000000. Call it "next".
2. I select the next layer, turn off its visibility to see the camera image with AOIs (Area Of Interest).
3. I use the paths tool to trace the outline of an AOI on next layer. I modify the paths to fit the AOI best I can.
4. I stroke the path to finish that AOI. I use a white color to stroke the paths.
5. I repeat 3 and 4. I have 4 AOIs in each camera image I'm working with.
6. I pick one of HTML notation colors 030303, 070707, 0b0b0b, or 0e0e0e as bucket fill for inside of each AOI.
7. I change the zoom to 200 or 400% to get a good look at the white outline of each AOI. I pick the respective gray per AOI and color over the white outline to make the whole AOI just one shade and get rid of white.
8. I change the mode of the layer to Grayscale in the Image menu.
9. In Layer>Transparency> Remove Alpha Channel
10. I export to PNG and save as 8bpc Gray with no background color.
I import the PNG to Python and then find that there are 16-20 values in the image.
I've attached an example of one of the next images. It's hard to see one of the AOIs because the 030303 is hard to tell from 000000, but you can see that AOIs get darker from one end to the other.
Is there a way to make sure that I'm just getting the background and the four AOI shades in the PNG?