To fix that a -fuzz factor will be needed.
Next the padding do not go completely around the image. as such a straight flood-fill color replacement will not do the job. To fix that you need to add a little more padding to connect all the areas together.
This extra padding as a bonus of actually provideing an exact white color pixel for our flood fill with fuzz factor to work from EG the pixel will be definatally pure white, and not some slightly off white color.
The final solution...
Note I saved to png. leave images that may be modifyed further as something other than JPEG. Archive those images and only convert them to JPEG for the web use. Basically avoid modifying to and from JPEG format multiple times.
Code: Select all
convert image.jpg -bordercolor white -border 1x1 -fill black \ -fuzz 25% -draw 'color 0,0 floodfill' -trim +repage image_fixed.png
The major problem you have now is that the JPG has turned the edge between the old black padding and the new white pddidng into a full range of grey scales. This will make it imposible to completely erase the border between these two areas without destroying the actual image.
You may need some hand triming and coloring to fix it entierly.