I have a set of images in a white or off white background. I want to convert the background to a particular hex value (#f1f0ee).
Tried using convert image -fuzz XX% -fill red -opaque white result
The problem here is, it will consider everything white, even parts of the product. Also, the edges need refinement, which does not happen using the above. I would like to perform this action in bulk.
Replace background colour to any hex code
-
- Posts: 16
- Joined: 2016-01-11T05:12:11-07:00
- Authentication code: 1151
Re: Replace background colour to any hex code
I found this interesting post a few years ago: http://tech.natemurray.com/2007/12/conv ... arent.html
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Replace background colour to any hex code
It might help, if you provide an example image. Also always provide your IM version and platform, since syntax may differ.
-
- Posts: 16
- Joined: 2016-01-11T05:12:11-07:00
- Authentication code: 1151
Re: Replace background colour to any hex code
IM Version 6.9.4fmw42 wrote:It might help, if you provide an example image. Also always provide your IM version and platform, since syntax may differ.
Windows Platform
Sample Image:
http://i.imgur.com/4Htli6m.jpg
-
- Posts: 16
- Joined: 2016-01-11T05:12:11-07:00
- Authentication code: 1151
Re: Replace background colour to any hex code
Great!! Thanks!fmw42 wrote:Try this:
Code: Select all
convert 4Htli6m.jpg -fuzz 1% -fill "#f1f0ee" -opaque white result.jpg