xico
is a simple svg
template.
Rendered with options from command-line or a template file.
It creates png
images from the svg
The svg
contains only 2 elements
<rect>
SVG/Element/rect<text>
SVG/Element/text
Most of their attributes rect attr and text attr are added.
Check Custom Attributes section for adding custom attributes.
xico [OPTION]... CHR FILE
possible 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_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' แฎฟ
All options or their alias can be set in a xico template
set
, put
, res
and pre
are the only commands
Note
template
file name or extension can be anything
set <option> <value>
This will set or update the option
set
commands can be repeated, the latest would take precedence.
# foo.xc
set r_fill #3311FF
set t_font-size 64px
Or alias if available
set bg #3311FF
set 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 all set
options, any put
afterwards would use the default options
pre <path>
Any put
afterwards will output with this prefix.
EG.
# ...
pre /tmp/foo
set bg red
put ใ hoge.png
set fg blue
put ใ fuga.png
# will create
# /tmp/foo/hoge.png
# /tmp/foo/fuga.png
pre $HOME/.config/awesome/layout/
set fg #3311FF
put โฌ tiletop.png
put โจ tileright.png
set fg #AA44FF
put โฌ tilebottom.png
put โง tileleft.png
res
put โฌ with_default_option_tilebottom.png
put โง with_default_option_tileleft.png
eg. xico -bg red -fg '#3311ff' ๓ฐง hello.png
๐ก Check complete template templates/default.xc
๐ฃ Check starter template templates/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 with size
or its alias s
eg. size 700
or s 700
would be a square 700x700px png
Important
size
is integer without any unit, its always in px
Note
The text is always centered
it can be adjusted with t_x, t_y, t_dx, t-dy
Note
The output is always full square on (0,0)
Note
the background default radius is 25
set radius to 50
for a perfect circle
you can set radius with r
or r_rx
and r_ry
Caution
options with special character need quoting
Note
Options can be used mixed together as command-line options or in template
Important
Options can be repeated the final one takes precedence.
# convert one character
xico ๐บ lambda.png
# create png from character with rounded cover, custom fg and bg, font size
xico -bg '#112233' -fg '#4411ff' -fs 4em ๐บ ~/pics/x1.png
# create a new image from character with custom color, transparent background and default config
xico -fg '#AA1144' โช ~/pics/x2.png
# process a template file
# xico -t awesome-xico.xc
To add other attributes add an entry To add the XC
associative array.
Prefix r_
for <rect>
element and t_
for <text>
element
Almost all Presentation attributes should work
For <rect>
[r_<attribute>]=<default>
For <text>
[t_<attribute>]=<default>
eg.
[t_stroke]='#0077EE'
[t_stroke-width]=3
[t_writing-mode]=vertical-lr
[r_stroke-width]=2
[r_stroke-linejoin]=round
[r_stroke-miterlimit]=214
Is a simple SVG file placed in lib/xico.svg can easily be extended.
- clone repo
- give execution permissions
- place it in your path
# Clone the repo
git clone git@github.com:metaory/xico.git
# Navigate to repo
cd xico
# Give execution permissions
chmod +x xico
# Link it somewhere in your PATH
ln -svf $PWD/xico /usr/bin/xico
# Use it anywhere
xico ๐ฐ zig.png
xico -bg '#112222'-fg '#AA11FF' -r 50 ๐บ lambda.png
# Usage
xico --help
- Dynamic readme usage
- Dynamic cli usage
- Dynamic attributes
- Reset opts action
- Template
- Attributes; bg, fg, font, size
-
[.] ImageMagick cairo
-
[.] libvips cairo
-
[.] librsvg cairo
-
Handle env settings
-
Handle stdin
-
Makefile
# XICO_SILENT | less verbose
# XICO_DEBUG | debug mode
inkscape(1)
metaory <[email protected]>, Apr 2024
โโโโโโโโโโโโโ
โโโโโโโโโโโโโ
โโโโโโโโv0.7โ