Skip to content
Extraits de code Groupes Projets
Valider 402aa823 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Merge branch 'fix_gif_dimensions' into 'master'

Improve stickers generations for gifs

See merge request Tigriz/matrix-stickers!37
parents b096c3be e8eaf872
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -160,13 +160,13 @@ validate_homeserv() {
}
file_get_width() {
local WIDTH=$(identify -format "%w" "$1") >/dev/null
local WIDTH=$(identify -format "%w" "$1[0]") >/dev/null
local WIDTH=$(( $WIDTH > 256 ? 256 : $WIDTH ))
echo "$WIDTH"
}
file_get_height() {
local HEIGHT=$(identify -format "%h" "$1") >/dev/null
local HEIGHT=$(identify -format "%h" "$1[0]") >/dev/null
local HEIGHT=$(( $HEIGHT > 256 ? 256 : $HEIGHT ))
echo "$HEIGHT"
}
......@@ -195,13 +195,15 @@ picture_process_sticker() {
local HEIGHT=$5 # The HEIGHT!
local TYPE=$6 # The type of the file (png/gif)
local repage=`[ "x${TYPE}" != "xgif" ] && echo '+repage' || echo ''`
local resize=`[ "x${TYPE}" != "xgif" ] && echo "-resize ${WIDTH}x${HEIGHT}" || echo ''`
local OPTS=`[ "$TYPE" = "png" ] && echo '-type TrueColor PNG32:' || echo ' -coalesce '`
info "File '$FILE' => '$DEST' ($TYPE) | OPTS = '$OPTS'"
convert "$FILE" -bordercolor none -border 1 "$DEST" 1>&2 && progress_dot || die "$NAME failed on border"
convert "$DEST" -trim +repage "$DEST" 1>&2 && progress_dot || die "$NAME failed on trim"
convert -background none -gravity center "$DEST" -resize "${WIDTH}x${HEIGHT}" $OPTS"$DEST" 1>&2 \
convert "$DEST" -trim ${repage} "$DEST" 1>&2 && progress_dot || die "$NAME failed on trim"
convert -background none -gravity center "$DEST" ${resize} $OPTS"$DEST" 1>&2 \
&& progress_dot \
|| die "$NAME failed on ${WIDTH}x${HEIGHT} resize"
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter