diff --git a/.gitignore b/.gitignore index f1962b88b..b1ccc1e75 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ CMakeLists.txt.* build* .kdev4/ *.kdev4 +support-chat-avatar.png diff --git a/logo.svg b/logo.svg index 99fb10d5f..26bc2f305 100644 --- a/logo.svg +++ b/logo.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/utils/render-graphics.sh b/utils/render-graphics.sh new file mode 100755 index 000000000..c4b56afa9 --- /dev/null +++ b/utils/render-graphics.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2023 Melvin Keskin +# +# SPDX-License-Identifier: GPL-3.0-or-later + +QXMPP_SOURCES=$(dirname "$(readlink -f "${0}")")/.. + +echo "*****************************************" +echo "Rendering graphics" +echo "*****************************************" + +render_support_chat_avatar() { + render_svg_with_margin $QXMPP_SOURCES/logo.svg $QXMPP_SOURCES/support-chat-avatar.png 300 300 18 +} + +# $1 - $4: see render_svg() +# $5: margin +render_svg_with_margin() { + output_directory=$(dirname $2) + mkdir -p $output_directory + tmp_file=$output_directory/rendered_tmp.svg + inkscape -o $tmp_file --export-margin=$5 $1 + render_svg $tmp_file $2 $3 $4 + rm $tmp_file +} + +# $1: input file +# $2: output file +# $3: width +# $4: height +render_svg() { + inkscape -o $2 -w $3 -h $4 $1 >/dev/null + optipng -quiet -o7 $2 >/dev/null + advpng -z4 $2 >/dev/null + echo "Created "$2 +} + +render_support_chat_avatar