Конвертировать .svg в .png поменять цвет и фон

Содержание
Введение
Показать все файлы
Похожие статьи

Введение

Перед тем как читать эту статью убедитесь, что вы знакомы с содержанием статьи «Основы Bash»

Конвертировать .svg в .png

Назовем скрипт для конвертации .svg в .png list_sites.sh

#!/bin/bash OLD_EXT=svg NEW_EXT=png DOT="." NEW_COLOR=E80FE3 NEW_BG=lightblue PATTERN1="s@stroke\=\"#000000\"@stroke\=\"#$NEW_COLOR\"@" PATTERN2="s@fill\=\"#000000\"@fill\=\"#$NEW_COLOR\"@" for file in ./*; do EXT="${file##*.}" if [[ $EXT = "svg" ]]; then # with extension fullname="${file##/}" # e.g. ./IMAGE.svg # echo "fullname" # echo $fullname # without extension filename="${file%.*}" # e.g. ./IMAGE echo "filename" echo $filename new_file=$filename$DOT$NEW_EXT echo $new_file if test -f "$new_file"; then echo "$(date '+%Y-%m-%d %H:%M:%S,%3N')" ____ "\ $new_file exists" >> convert_to_png.log else echo "$(date '+%Y-%m-%d %H:%M:%S,%3N')" ____ "\ Converting $file to $new_file" >> convert_to_png.log sed -i $PATTERN1 $fullname sed -i $PATTERN2 $fullname # sed -i 's@stroke\="#000000"@stroke\="#E80FE3"@' $fullname # sed -i 's@fill\="#000000"@fill\="#E80FE3"@' $fullname inkscape -b lightblue $fullname --export-type=png --export-filename=$new_file # mv $fullname $new_file fi fi done

Article author: Andrei Olegovich

Похожие статьи
Bash скрипты
Основы скриптов
Работа с файлами в директории
.svg → .png
Разрезать mp3 на части Bash
Чистка Docker Volume
Banner image

Search this site

Subscribe to Telegram channel @aofeed to follow new articles and updates to old ones

Go to channel

@aofeed

Ask a question in the Telegram group

@aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su, info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: