#!/bin/sh

if [ "$1" = "" ]; then
  echo "Specify filename"
  exit
fi

FILE=$1

LIST_REQ=`cat required.txt`

for i in $LIST_REQ ; do
  echo "strip, convert, and copy: $i -> ../$i"
  magick $i -strip -background '#000000' -alpha remove -alpha off -define png:color-type=0 -define png:bit-depth=8 _tmp_.png
  magick _tmp_.png -threshold '0.2%' -define png:color-type=0 -define png:bit-depth=8 ../$i
  rm -f _tmp_.png
done

