Skip to content
/ xico Public

๐†–๐–ญ๊›•๐Š” -- simple cli to make png images from any Unicode glyph character ๐“ท

License

Notifications You must be signed in to change notification settings

metaory/xico

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐†–๐–ญ๊›•๐Š”

simple cli to make png images from ascii characters


DESCRIPTION

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

Most of their attributes rect attr and text attr are added.

Check Custom Attributes section for adding custom attributes.

SYNOPSIS

xico [OPTION]... CHR FILE

possible output FILE extension[svg,png,ps,eps,pdf,emf,wmf,xaml]

Options

CLI Only Options

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

Options

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

CLI Usage

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' แฎฟ

Template Usage

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 command
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 command

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 command

res

Or

reset

Will reset all set options, any put afterwards would use the default options

PRE command

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

Get Started

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.


EXAMPLES

# 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

Custom Attributes

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

The SVG template

Is a simple SVG file placed in lib/xico.svg can easily be extended.


Requirements


Installation

  • 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

TODO

  • Dynamic readme usage
  • Dynamic cli usage
  • Dynamic attributes
  • Reset opts action
  • Template
  • Attributes; bg, fg, font, size
Fallback rendering engines

ENVIRONMENT VARIABLES

# XICO_SILENT    | less verbose
# XICO_DEBUG     | debug mode

SEE ALSO

inkscape(1)

AUTHOR

metaory <metaory@gmail.com>, Apr 2024

โ–€โ–„โ–€โ€ƒโ–ˆโ€ƒโ–ˆโ–€โ–€โ€ƒโ–ˆโ–€โ–ˆ
โ–ˆโ–‘โ–ˆโ€ƒโ–ˆโ€ƒโ–ˆโ–„โ–„โ€ƒโ–ˆโ–„โ–ˆ
โ–โ–โ–โ–โ–โ–โ–โ–v0.7โ–

License

MIT