Skip to content

Instantly share code, notes, and snippets.

@d0n13
Last active October 6, 2021 13:43
Show Gist options
  • Save d0n13/7ea53e3cfa6378804c7703e0c39e1094 to your computer and use it in GitHub Desktop.
Save d0n13/7ea53e3cfa6378804c7703e0c39e1094 to your computer and use it in GitHub Desktop.
Convert single pixel AprilTag images to custom bitmap sizes without distortion
#!/bin/bash
# resizse 1 pixel AprilTag to 300x300 without blurring
mogrify -path out -filter box -resize 300x300 tag36_11_0*
# remove 29 pixels from around the outside if required
mogrify -path shaved -shave 29x29 *.png
# Run multiple commands over multiple CPUs with 100 operations per thread
find . -name "*.png" | xargs -P8 -n100 mogrify -path out -filter box -resize 300x300
# Convert white background in markers to transparent
find . -name "*.png" | xargs -P8 -n100 convert {} -transparent White {} \;
@d0n13
Copy link
Author

d0n13 commented Sep 30, 2021

You need to install ImageMagick for these scripts: imagemagick.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment