Add webp support to deface. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit bf7dd5abc4d78df9e378472140b95c84fc964ea3 | |
parent 2a8d58f5050e30643aa3704c3047016cb35c8269 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sun, 7 Aug 2022 13:58:42 +0200 | |
Add webp support to deface. | |
Diffstat: | |
M annna-message-common | 16 ++++++++++++++++ | |
M ffmpeg-effect | 4 ---- | |
2 files changed, 16 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -903,6 +903,15 @@ case "${text}" in | |
mimetype="$(file --mime-type "$inpath" | cut -d':' -f … | |
# Only allow images to be free. | |
case "$mimetype" in | |
+ image/webp) | |
+ # deface does not like webp. Make it png. | |
+ newinpath="$(mktemp -u -p /tmp "${infile%.*}XX… | |
+ convert "${inpath}" "${newinpath}" >/dev/null … | |
+ inpath="${newinpath}" | |
+ | |
+ outfile="${outfile%.*}.png" | |
+ outpath="${outpath%.*}.png" | |
+ ;; | |
image/*) | |
outfile="${outfile%.*}.${origext}" | |
outpath="${outpath%.*}.${origext}" | |
@@ -931,6 +940,13 @@ case "${text}" in | |
;; | |
esac | |
+ # Remove temporary png for deface. | |
+ case "${inpath}" in | |
+ /tmp/*.png) | |
+ [ -e "${inpath}" ] && rm "${inpath}" | |
+ ;; | |
+ esac | |
+ | |
if [ "${recipient}" != "${text}" ]; | |
then | |
user="${recipient}" | |
diff --git a/ffmpeg-effect b/ffmpeg-effect | |
@@ -74,8 +74,6 @@ mix_audio_video() { | |
} | |
replace_face() { | |
- set -x | |
- | |
face_replacement="$1" | |
input="$2" | |
output="$3" | |
@@ -97,8 +95,6 @@ replace_face() { | |
else | |
mv "$tmp" "$output" | |
fi | |
- | |
- set +x | |
} | |
process_filter() { |