Hi
I need to change colour of particular area in the image. I am a java developer. So, can use JMagick or other (sorry forgot its name) java api.
In this image i want to change the sash and flower colour (currently in peach color) to any color at runtime, say fuschia, blue, green, etc.
I have tried on command line but it does not work for me. The command I used was
convert peach-flower.gif -fill white -draw -fuzz 13% 'color 162,60 replace' peachflowerwhite.gif
Got the following messages, the file peachflowerwhite.gif is created but with no changes
convert: Non-conforming drawing primitive definition `-' @ error/draw.c/DrawImage/3146.
convert: unable to open image `13%': No such file or directory @ error/blob.c/OpenBlob/2584.
convert: no decode delegate for this image format `13%' @ error/constitute.c/ReadImage/532.
convert: unable to open image `'color': No such file or directory @ error/blob.c/OpenBlob/2584.
convert: no decode delegate for this image format `'color' @ error/constitute.c/ReadImage/532.
convert: unable to open image `162,60': No such file or directory @ error/blob.c/OpenBlob/2584.
convert: no decode delegate for this image format `162,60' @ error/constitute.c/ReadImage/532.
convert: unable to open image `replace'': No such file or directory @ error/blob.c/OpenBlob/2584.
convert: no decode delegate for this image format `replace'' @ error/constitute.c/ReadImage/532.
convert: Non-conforming drawing primitive definition `-' @ error/draw.c/DrawImage/3146.
Any help is appreciated
Change color of image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Change color of image
try moving -fuzz before the -draw
convert peach-flower.gif -fuzz 13% -fill white -draw 'color 162,60 replace' peachflowerwhite.gif
This works for me on IM 6.6.6.6 Q16, but the results are not very satisfying.
You will likely need to mask out the peach areas (by tracing) and then modify the image and composite them back so that where not peach you use the original and where it was peach you use the modified image. The composite operation allows you to use 3 image -- background overlay and mask.
see http://www.imagemagick.org/Usage/compose/#compose and http://www.imagemagick.org/Usage/layers/
convert peach-flower.gif -fuzz 13% -fill white -draw 'color 162,60 replace' peachflowerwhite.gif
This works for me on IM 6.6.6.6 Q16, but the results are not very satisfying.
You will likely need to mask out the peach areas (by tracing) and then modify the image and composite them back so that where not peach you use the original and where it was peach you use the modified image. The composite operation allows you to use 3 image -- background overlay and mask.
see http://www.imagemagick.org/Usage/compose/#compose and http://www.imagemagick.org/Usage/layers/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Change color of image
In this case using a mask to mask out the background, and then modulating the hue of the colors may work better than attempting to directly modify those pixels.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/