I have a kind of large script with image magick commands. One of the commands is supposed to add a green border color and fill 2 small regions inside the image with white, but the 2 regions are being filled with the same color of the borders (#6BFFB0 in this case)
How to force that borders have one color and the 2 other regions have white in a single command?
This is the "one line" command I have so far with 3 repage.
+repage -bordercolor #6BFFB0
+repage -region 870x40+7+40 -fill white -colorize 100
+repage -region 30x30+830+92 -fill white -colorize 100
This is the IM version I'm using in cygwin.
$ convert -version
Version: ImageMagick 7.0.10-61 Q16 x86_64 2023-05-13 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib cairo djvu fftw fontconfig fpx freetype gslib gvc heic jbig jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raqm raw rsvg tiff webp x xml zlib
Thanks in advance
It is always more helpful if you let us know what version of ImageMagick you're using, and also what operating system/platform you're working on.
That said, you don't need to "+repage" unless you've changed the geometry.
At the end of a "-region" operation you need to change it to another "-region", or end the setting with "+region" after the last one.
To solve the problem with your regions turning to the border color, add "-channel RGB" ahead of the "-colorize" operations, and "+channel" after them. That will restrict the operation to use only RGB channels. For some reason without the channel specifier it will just leave the regions transparent. So however you use it in your command, it should be more like this...
+repage -bordercolor #6BFFB0
-channel RGB
-region 870x40+7+40 -fill white -colorize 100
-region 30x30+830+92 -fill white -colorize 100
+region
+channel