#!/usr/bin/env bash
set -o xtrace

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)

cd "${SCRIPT_DIR}" && gnuplot -c sleep_delay.gp

while IFS= read -r -d '' f; do
  output=$(echo "$f" | sed -E 's/\.eps$/.png/')
  convert -density 300 "eps2:${f}" "$output"
done < <(find "${SCRIPT_DIR}" -name '*.eps' -print0)
