I'm wondering how to convert this working command line sequence for ImageMagick into a Python script using the Wand library:
convert me.jpg -fill none -fuzz 1% -draw 'matte 0,0 floodfill' -flop -draw 'matte 0,0 floodfill' -flop me.png
It basically allows me to subtract a known background image from my foreground image with some tolerance (i.e. fuzz). I want to fill in the resulting area with a flat color.
I want to do all this in memory and with my Python script to avoid recompressing my decoded RAW image data as a jpeg twice. Doing it via the command line forces the extra compression step, doing it in the script would just require one jpeg save.
Some help with this would be most appreciated.
Edit: Correction, was getting confused with something else I had tried. The above command does not subtract from a known image. This actually takes the top left pixel and flood fills from there with 1% fuzz. Obvious really when you can see there is only one input image. Still knowing how to convert the above into Python is still helpful.