linux - How to erase all pixels of certain color on every file inside a folder? -
is there easy way convert images in folder, every pixel specific color removed?
you should define "removed" means. if mean replaced other (background) color, can convert single file this:
convert -fill replacement_color -opaque original_color \ original_image modified_image
if "removed" mean make pixels transparent, can convert single file this:
convert -transparent original_color original_image modified_image
where original_image , modified_image input , output image files respectively , original_color , replacement_color original , replacement colors in imagemagick color format.
now, example, replace red pixels white pixels in images in current directory , save them names prefixed "modified_":
for f in *; convert -fill white -opaque red "$f" "modified_$f" done
Comments
Post a Comment