srmsoumya / giffer Goto Github PK
View Code? Open in Web Editor NEWTemplatize GIFs
Templatize GIFs
Generalize the code for any new GIF added to the pipeline
data/gifs/symptom.jpg
, data
: Google SheetDuration of each frame works for certain duration like 0.12, 0.18 etc or else the video conversion doesn't do the animation.
Refactor to use google sheet, and reducing hard coded variables.
import pandas as pd
url = 'https://docs.google.com/spreadsheets/d/{key}/export?format=csv&gid={gid}'
df = pd.read_csv(url.format(key='1qYVSVN3WLMha8J9wofdADxbX0USFJ1l-Yc5M1EfjIC8', gid='166461608'))
dff = df.iloc[1:].set_index('language')
setup fonts from https://github.com/saiswa/free-fonts
part-2
def make_content(lang):
TL = dff[lang]
return {
"27": {
'captions': [
{'caption': wrapper(TL.T1), 'point': (475, 300), 'fill': (0,0,0), 'font_size': 100}
]},
"29": {
'captions': [
{'caption': wrapper(TL.T2), 'point': (190, 100), 'fill': (0,0,0), 'font_size': 30}
]},
"30": {
'captions': [
{'caption': wrapper(TL.T2), 'point': (190, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T3), 'point': (525, 100), 'fill': (0,0,0), 'font_size': 30}
]},
"31": {
'captions': [
{'caption': wrapper(TL.T3), 'point': (190, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T3), 'point': (525, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T4), 'point': (415, 570), 'fill': (0,0,0), 'font_size': 30}
]},
"32": {
'captions': [
{'caption': wrapper(TL.T2), 'point': (190, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T3), 'point': (525, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T4), 'point': (415, 570), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T5), 'point': (820, 640), 'fill': (0,0,0), 'font_size': 30}
]},
"33": {
'captions': [
{'caption': wrapper(TL.T2), 'point': (190, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T3), 'point': (525, 100), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T4), 'point': (415, 570), 'fill': (0,0,0), 'font_size': 30},
{'caption': wrapper(TL.T5), 'point': (820, 640), 'fill': (0,0,0), 'font_size': 30}
]},
}
langs = ['hindi', 'telugu', 'kannada', 'tamil', 'malayalam', 'odiya', 'gujarati', 'punjabi', 'bengali']
for lang in langs:
# get fonts from https://github.com/saiswa/free-fonts
FONT = {'family': DATA/'fonts'/'indic'/f'Lohit {lang.title()}, Regular.ttf'}
print(f'Creating {lang}.gif')
giffer(DATA/'distance.gif', make_content(lang), FONT, f'{lang}.gif')
Languages that work well in the current setup
However, we have to modify the L2
,U2
& size
to prevent the text overflowing for the following languages
Fix this functionality to work uniformly for all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.