Add script for hashing arbitrary files with imagemagick and stdin example
This commit is contained in:
parent
66858e4d1a
commit
1bc89ddc42
|
@ -24,6 +24,7 @@
|
||||||
cargo-show-asm
|
cargo-show-asm
|
||||||
clippy
|
clippy
|
||||||
imagemagick
|
imagemagick
|
||||||
|
jq
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
rustc
|
rustc
|
||||||
rustfmt
|
rustfmt
|
||||||
|
|
18
scripts/hash.sh
Executable file
18
scripts/hash.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if ! [ -f "$1" ]; then
|
||||||
|
echo "$1" is not a file;
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
json=$(magick convert "$1" JSON:-)
|
||||||
|
|
||||||
|
width=$(echo $json | jq '.[0].image.geometry.width')
|
||||||
|
height=$(echo $json | jq '.[0].image.geometry.height')
|
||||||
|
|
||||||
|
magick convert "$1" RGBA:- | \
|
||||||
|
cargo r --example stdin --release -- \
|
||||||
|
--width $width \
|
||||||
|
--height $height
|
Loading…
Reference in a new issue