Add webp support to deface. - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
DIR commit bf7dd5abc4d78df9e378472140b95c84fc964ea3
DIR parent 2a8d58f5050e30643aa3704c3047016cb35c8269
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
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(-)
---
DIR 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 2 | cut -c 2-)"
# 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%.*}XXXXX.png")"
+ convert "${inpath}" "${newinpath}" >/dev/null 2>&1
+ 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}"
DIR 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() {