Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lolgear/66d1d5744e566e6bc0fa721a9ed54c11 to your computer and use it in GitHub Desktop.
Save lolgear/66d1d5744e566e6bc0fa721a9ed54c11 to your computer and use it in GitHub Desktop.
ls Resources/*.png | perl -lne '$old = $_; s/(\@\w+)/_inverted$1/; $_ = qx(basename $_); chomp; $_ = qq(Results/$_); $s = qq(convert $old -fuzz 10% -fill none +opaque white $_); print $s; print qx($s);'
# 1. details:
# 2. take png images from directory Resources
# 3. append "_inverted" before \@ symbol.
# 4. convert $old -fuzz 10% -fill none +opaque white $new
# 5. -fuzz add threshold in 10% for white color. Which are NOT white in 10% thresholds would be removed.
# 6. -fill none should fill color with transparent color
# 7. +opaque matches color to be replaced. plus add inversion. So, +opaque matches these colors that SHOULD NOT be replaced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment