- Notifications
You must be signed in to change notification settings - Fork0
A simple tool to make images from a single character or in bulk from a template
License
metaory/xico
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
xico
is a simplesvg
template.
Rendered with options from command-line or a template file.
It createspng
images from thesvg
Thesvg
contains only 2 elements
<rect>
SVG/Element/rect<text>
SVG/Element/text
Most of their attributesrect attr andtext attr are added.
CheckCustom Attributes section for adding custom attributes.
xico [OPTION]... CHR FILEpossible output FILE extension[svg,png,ps,eps,pdf,emf,wmf,xaml]
These options are only available on CLI--export-filename Output file name
cli option | alias | default |
---|---|---|
--help | -h | |
--size | -s | 500 |
--template | -t | |
--delay | 3 | |
--no-delay |
These options are available in template and CLI
option | alias | default |
---|---|---|
delay | d | 3 |
size | s | 500 |
background | xbg | black |
background-opacity | xbo | 0 |
rect option | alias | default |
---|---|---|
r_fill | bg | black |
r_width | w | 100 |
r_height | h | 100 |
r_opacity | o | 0.5 |
r_rx | r | 25 |
r_ry | r | 25 |
r_x | 0 | |
r_y | 0 |
text option | alias | default |
---|---|---|
t_fill | fg | #3311FF |
t_stroke-color | stroke | cyan |
t_stroke-width | border | 0 |
t_stroke-linecap | round | |
t_stroke-linejoin | round | |
t_font-family | ff | monospace |
t_font-weight | fw | bold |
t_font-size | fs | 8em |
t_rotate | 0 | |
t_transform | translate(0,0) | |
t_transform-origin | center | |
t_dx | 0 | |
t_dy | 3.5 | |
t_x | x | 50 |
t_y | y | 50 |
Note
In command-line
long-options prefixed with double hyphen--
aliases with single hyphen-
eg.t_font-size 9em
or-fs 9em
eg.
xico --r_fill '#3300FF' λ
Or alias if available
xico -bg '#3300FF' ᮿ
Accept various forms of input, such as stdin, local files & dirs, and remote URLs.
Input | Example |
---|---|
CMD input | xico hello |
Stdin pipe | cat data.txt | xico |
Local files | xico -f data.txt |
Local images | xico -f image.png |
Local directories | xico -f dir/ |
Remote URLs | xico -f https://example.com |
Combine Inputs | xico -f dir/ -f data.txt explain |
All options or their alias can be set in a xico template
set
,put
,res
andpre
are the only commands
Note
template
filename orextension can be anything
set <option> <value>
This will set or update the option
set
commands can be repeated, the latest would take precedence.
# foo.xcset r_fill #3311FFset t_font-size 64px
Or aliasif available
set bg #3311FFset fs 10em
Set commands can be repeated, every set will overwrite the previous value
put <char> <destination>
This will create an image from the<char>
and place it<destination>
with the current set options
Put commands can be repeated, every put will use the options set to that point
res
Or
reset
Will reset allset
options, anyput
afterwards would use the default options
pre <path>
Anyput
afterwards will output with this prefix.
EG.
# ...pre /tmp/foosetbg redput テ hoge.pngsetfg blueput た fuga.png# will create#/tmp/foo/hoge.png#/tmp/foo/fuga.pngpre$HOME/.config/awesome/layout/setfg#3311FFput ⬒ tiletop.pngput ◨ tileright.pngsetfg#AA44FFput ⬓ tilebottom.pngput ◧ tileleft.pngresput ⬓ with_default_option_tilebottom.pngput ◧ with_default_option_tileleft.png
eg. xico -bg red -fg '#3311ff' hello.png
💡 Check complete templatetemplates/default.xc
🐣 Check starter templatetemplates/starter.xc
cp templates/starter.xc <path>xico -t <path>
Caution
The final positional arguments is required if no template is provided
Note
The output is always square
Set the output size withsize
or its aliass
eg.size 700
ors 700
would be a square 700x700px png
Important
size
is integer without any unit,its always inpx
Note
The text is always centered
it can be adjusted witht_x, t_y, t_dx, t-dy
Note
The output is always full square on(0,0)
Note
the background default radius is25
set radius to50
for aperfect circleyou can set radius withr
orr_rx
andr_ry
Caution
options with special character need quoting
Note
Options can be used mixed togetheras command-line options or in template
Important
Options can be repeatedthe final one takes precedence.
# convert one characterxico 𝝺 lambda.png# create png from character with rounded cover, custom fg and bg, font sizexico -bg '#112233' -fg '#4411ff' -fs 4em 𝝺 ~/pics/x1.png# create a new image from character with custom color, transparent background and default configxico -fg '#AA1144' ✪ ~/pics/x2.png# process a template file# xico -t awesome-xico.xc
To add other attributes add an entry To add theXC
associative array.Prefixr_
for<rect>
element andt_
for<text>
element
Almost allPresentation attributes should work
For<rect>
[r_<attribute>]=<default>
For<text>
[t_<attribute>]=<default>
eg.
[t_writing-mode]=vertical-lr[r_stroke-miterlimit]=214
Is a simple SVG file placed inlib/xico.svg can easily be extended.
- clone repo
- give execution permissions
- place it in your path
# Clone the repogitclonegit@github.com:metaory/xico.git# Navigate to repocdxico# Give execution permissionschmod+xxico# Link it somewhere in your PATHln-svf $PWD/xico/usr/bin/xico# Use it anywherexico 𐰒zig.pngxico-bg'#112222'-fg'#AA11FF'-r50 𝝺 lambda.png# Usagexico--help
- Dynamic readme usage
- Dynamic cli usage
- Dynamic attributes
- Reset opts action
- Template
- Attributes; bg, fg, font, size
[.]ImageMagickcairo
[.]libvipscairo
[.]librsvgcairo
Handle env settings
Handle stdin
Makefile
# XICO_SILENT | less verbose# XICO_DEBUG | debug mode
inkscape(1)
metaory <metaory@gmail.com>, Apr 2024
▀▄▀ █ █▀▀ █▀██░█ █ █▄▄ █▄█▁▁▁▁▁▁▁▁v0.7▁
About
A simple tool to make images from a single character or in bulk from a template