How to convert images for web from the command line
The Abraia CLI tool provides a simple and direct way to convert your images and photos
for web. Enabling the conversion from different input formats to get images in the right formats to be
used in the web - JPEG, WebP, or PNG -. Moreover, it supports a number of transformations that can be applied
to image batches. So you can easily convert your images to be directly published on the web.
Abraia CLI tool installation
Abraia CLI is a multiplatform tool (Windows, Mac, Linux) based on Python (Python 2.6.5 or
higher), that can be be installed with a simple command:
python -m pip install -U abraia
If you are on Windows install Python first,
otherwise open a terminal or command line and write the previous command to install or upgrade the Abraia CLI.
The first time you run Abraia CLI you need to configure your API
key, just write the command bellow and paste your API key.
$ abraia configure
Now, you are ready to convert your images from the command line.
Convert SVG to PNG
Converting a SVG image to PNG, now is so simple as to type the command bellow:
abraia convert bat.svg bat.png
The SVG vector image is rendered in a Chrome instance to provide maximum fidelity, and
preserving the transparent background.
Convert image to WebP
The JPEG image format is still the most common format to publish photos on the web.
However, converting images to WebP provides a significant improvement for web publishing. To convert an image
to WebP just write a simple command like bellow:
abraia convert garlic.jpg garlic.webp
The same can be used to convert a GIF animation to WebP and save several bytes.
abraia convert bob-sponge.gif bob-sponge.webp
Convert PSD to JPG
A .PSD file is a layered image file used in Adobe PhotoShop for saving data. You can
easily convert then, and get the result of flattening all the visible layers with a command like bellow:
abraia convert strawberry.psd strawberry.jpg
The previous command just convert a PSD file to JPEG, automatically adding a white
background, in this case, because the JPEG format does not support transparency. Instead, using the PNG format
you can preserve the transparent background.
abraia convert strawberry.psd strawberry.png