[FIX] Fixed bug where the similarity check would run on the compressed image vs the original one, giving a highe-than expected difference.
We now only compress the image after a new one has been selected
This commit is contained in:
+6
-6
@@ -68,13 +68,13 @@ then
|
|||||||
else
|
else
|
||||||
# If cwebp is available, convert the new screenshot to webp format and delete the original png
|
# If cwebp is available, convert the new screenshot to webp format and delete the original png
|
||||||
if command -v cwebp > /dev/null; then
|
if command -v cwebp > /dev/null; then
|
||||||
WIDTH=$(identify -format "%w" $SCR_NEW)
|
WIDTH=$(identify -format "%w" $SCR_LAST)
|
||||||
TARGET_WIDTH=$(( WIDTH * ${SCALE%%%} / 100 ))
|
TARGET_WIDTH=$(( WIDTH * ${SCALE%%%} / 100 ))
|
||||||
echo "Converting $SCR_NEW to webp format with target width $TARGET_WIDTH"
|
echo "Converting $SCR_LAST to webp format with target width $TARGET_WIDTH"
|
||||||
# I tried some different cwebp options (-preset text/picture), -m 6), but default seems to give the best results especially given runtime.
|
# I tried some different cwebp options (-preset text/picture), -m 6), but default seems to give the best results especially given that it's fast.
|
||||||
cwebp -quiet -resize $TARGET_WIDTH 0 $SCR_NEW -o "${SCR_NEW%.png}.webp"
|
cwebp -quiet -resize $TARGET_WIDTH 0 $SCR_LAST -o "${SCR_LAST%.png}.webp"
|
||||||
rm $SCR_NEW
|
rm $SCR_LAST
|
||||||
SCR_NEW="${SCR_NEW%.png}.webp"
|
SCR_LAST="${SCR_LAST%.png}.webp"
|
||||||
else
|
else
|
||||||
# If cwebp is not available, we can still reduce the size of the png by resizing it with mogrify
|
# If cwebp is not available, we can still reduce the size of the png by resizing it with mogrify
|
||||||
mogrify -scale $SCALE $SCR_LAST
|
mogrify -scale $SCALE $SCR_LAST
|
||||||
|
|||||||
Reference in New Issue
Block a user