Created
November 29, 2023 16:24
-
-
Save CardealRusso/d138385a965add81e35852c15dbaead1 to your computer and use it in GitHub Desktop.
Create a png with a false thumbnail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Create a png with a false thumbnail; | |
# looks different when you view it full res. | |
high="$1" # High image (full-size original view) | |
low="$2" # Low image (thumbnail) (should be the same size) | |
output="output.png" | |
[ ! -z "$3" ] && output="$3" # Output image | |
size=$(convert "$high" -format "%wx%h" info:) | |
convert "$high" -alpha off +level 3.5%,100% -gamma 20 high_gamma.png | |
low_gamma="-alpha off -gamma 0.8 +level 0%,77%" | |
convert \( "$low" $low_gamma \) high_gamma.png \ | |
-compose Mathematics -define compose:args='0,-0.33,1,0.33' \ | |
-composite low_adjusted.png | |
convert low_adjusted.png high_gamma.png -size $size pattern:gray25 -composite \ | |
-set gamma 0.022727 -define png:include-chunk=none,gAMA "$output" | |
rm high_gamma.png low_adjusted.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment