Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Riesi | 7a0cf0a5ee | |
Stefan Riesenberger | 84948470e0 | |
Stefan Riesenberger | 9e3046e544 | |
Stefan Riesenberger | 23d453a91f | |
Stefan Riesenberger | 5bfa097f4e | |
Stefan Riesenberger | accabc5119 | |
Stefan Riesenberger | 6e4cc1d26c | |
Miepee | cc043f933e | |
Miepee | 65dc5f5a92 | |
Miepee | 22f6881324 | |
Stefan Riesenberger | e2a0b97339 |
|
@ -1,3 +1,8 @@
|
|||
# This repository is abandoned!
|
||||
# New repository at https://github.com/Riesi/frog_emojis
|
||||
# Mirror at https://git.froggi.es/Riesi/frog_emojis
|
||||
|
||||
### -------------------------------------------------------------------------------------------------------------------
|
||||
Most of theses frogs are based on the SVGs of the twitter emoji set (https://twemoji.twitter.com). Others are unique designs with other inspirations in mind.
|
||||
|
||||
Have fun using them! 🐸
|
||||
|
|
|
@ -1,25 +1,126 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
###########################################################################
|
||||
# Copyright (C) 2022 Stefan Riesenberger
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
###########################################################################
|
||||
|
||||
import glob
|
||||
import ntpath
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
# Dependencies: grep, git, inkscape, python 3.9
|
||||
|
||||
|
||||
# deletes raster graphics with given name
|
||||
def delete_graphics(name):
|
||||
for f in name:
|
||||
for d in glob.glob("./png/**/"+str(f)+".png", recursive=True):
|
||||
print('deleting: ' +str(d))
|
||||
os.remove(d)
|
||||
|
||||
# rasters SVGs via Inkscape
|
||||
def raster_graphics(files):
|
||||
sizes = [16, 32, 64, 128, 256, 512, 1024, 4096]
|
||||
frogs = len(files)-1
|
||||
for f in files:
|
||||
name = ntpath.basename(f).replace(".svg", "")
|
||||
print('\n------------------------------\n'+ str(frogs) + ' remaining...\nRastering ' + str(name)+'\n')
|
||||
frogs = frogs - 1
|
||||
for s in sizes:
|
||||
# make sure the subdirectories exist
|
||||
width_path = "./png/fixed_width/"+str(s)+"/"+str(os.path.dirname(f.removeprefix('svg/').removesuffix('.svg')))
|
||||
height_path = "./png/fixed_height/"+str(s)+"/"+str(os.path.dirname(f.removeprefix('svg/').removesuffix('.svg')))
|
||||
if not( os.path.exists(width_path) and os.path.exists(height_path) ):
|
||||
os.makedirs(width_path ,exist_ok=True)
|
||||
os.makedirs(height_path ,exist_ok=True)
|
||||
# invoke Inkscape to raster the given vector graphics
|
||||
subprocess.run(["inkscape", f, "-C", "-w", str(s), "--export-filename="+str(width_path)+"/"+name+".png"],timeout=30)
|
||||
subprocess.run(["inkscape", f, "-C", "-h", str(s), "--export-filename="+str(height_path)+"/"+name+".png"],timeout=30)
|
||||
|
||||
# git add given files
|
||||
def git_add_raster(files):
|
||||
for f in files:
|
||||
f = f.removeprefix('svg/').removesuffix('.svg')
|
||||
stream = os.popen('git add ./png/**/'+str(f)+'.png')
|
||||
print(stream.read())
|
||||
|
||||
# git commit given files
|
||||
def git_commit_raster():
|
||||
stream = os.popen('git commit -m "[png] generate PNGs"')
|
||||
print(stream.read())
|
||||
|
||||
# create a new tag
|
||||
def create_tag():
|
||||
# get tags
|
||||
stream = os.popen('git tag -l "auto-v*"')
|
||||
output = stream.read()
|
||||
tags = output.split('\n')
|
||||
tags.remove('')
|
||||
# create new tag
|
||||
stream = os.popen('git tag auto-v'+str(len(tags)))
|
||||
print(stream.read())
|
||||
# -------------------------------------------------------------------------------------------------------------------------#
|
||||
# main section
|
||||
#
|
||||
files = list()
|
||||
if len(sys.argv) == 1:
|
||||
files = [f for f in glob.glob("./**/*.svg", recursive=True)]
|
||||
# get modified, added, renamed, deleted SVGs since last tag
|
||||
stream = os.popen('git diff --name-status $(git describe --tags --abbrev=0 --match "auto-v*") HEAD | grep svg/')
|
||||
output = stream.read()
|
||||
files = output.split('\n')
|
||||
files.remove('')
|
||||
|
||||
if len(files) == 0:
|
||||
print('nothing to do!')
|
||||
exit()
|
||||
additions = [s.removeprefix('A\t') for s in files if 'A\t' in s]
|
||||
modifications = [s.removeprefix('M\t') for s in files if 'M\t' in s]
|
||||
deleted = [s.removeprefix('D\tsvg/').removesuffix('.svg') for s in files if 'D\t' in s]
|
||||
renamed = [s.removeprefix('R100\t').split('\t') for s in files if 'R100\t' in s]
|
||||
|
||||
# also delete the renamed files and regenerate with the new name
|
||||
for r in renamed:
|
||||
deleted.append(r[0].removeprefix('svg/').removesuffix('.svg'))
|
||||
modifications.append(r[1])
|
||||
|
||||
#print('A:' + str(additions))
|
||||
#print('M:' + str(modifications))
|
||||
#print('D:' + str(deleted))
|
||||
#print('R100:' + str(renamed))
|
||||
|
||||
delete_graphics(deleted)
|
||||
git_add_raster(deleted)
|
||||
print('\nAdditions:')
|
||||
raster_graphics(additions)
|
||||
git_add_raster(additions)
|
||||
print('\nModifications:')
|
||||
raster_graphics(modifications)
|
||||
git_add_raster(modifications)
|
||||
|
||||
# commit and tag
|
||||
git_commit_raster()
|
||||
create_tag()
|
||||
else:
|
||||
for f in sys.argv:
|
||||
if os.path.exists("./svg/"+f+".svg"):
|
||||
files.append("./svg/"+f+".svg")
|
||||
if sys.argv[1] == 'all':
|
||||
files = [f for f in glob.glob("svg**/*.svg", recursive=True)]
|
||||
else:
|
||||
for f in sys.argv:
|
||||
f = f.removeprefix('svg/').removesuffix('.svg')
|
||||
if os.path.exists("svg/"+f+".svg"):
|
||||
files.append("svg/"+f+".svg")
|
||||
raster_graphics(files)
|
||||
|
||||
sizes = [16, 32, 64, 128, 256, 512, 1024, 4096]
|
||||
|
||||
for f in files:
|
||||
name = ntpath.basename(f).replace(".svg", "")
|
||||
for s in sizes:
|
||||
#subprocess.run(["inkscape", "-z", "-C", "-w", str(s), "-e", "./png/fixed_width/"+str(s)+"/"+name+".png", "-f", f])
|
||||
#subprocess.run(["inkscape", "-z", "-C", "-h", str(s), "-e", "./png/fixed_height/"+str(s)+"/"+name+".png", "-f", f])
|
||||
subprocess.run(["inkscape", f, "-C", "-w", str(s), "--export-filename=./png/fixed_width/"+str(s)+"/"+name+".png"])
|
||||
subprocess.run(["inkscape", f, "-C", "-h", str(s), "--export-filename=./png/fixed_height/"+str(s)+"/"+name+".png"])
|
||||
|
|
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 774 B |
After Width: | Height: | Size: 669 B |
After Width: | Height: | Size: 855 B |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 652 B |
After Width: | Height: | Size: 807 B |
After Width: | Height: | Size: 939 B |
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 838 B |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 915 B |