ImageMagick preprocessor for Foliant.
Project description
ImageMagick Preprocessor
This tool provides additional processing of images that referred in Markdown source, with ImageMagick.
Installation
$ pip install foliantcontrib.imagemagick
Config
To enable the preprocessor, add imagemagick
to preprocessors
section in the project config:
preprocessors:
- imagemagick
The preprocessor has a number of options with the following default values:
preprocessors:
- imagemagick:
convert_path: convert
cache_dir: .imagemagickcache
convert_path
: Path to convert
binary, a part of ImageMagick.
cache_dir
: Directory to store processed images. These files can be reused later.
Usage
Suppose you want to apply the following command to your picture image.eps
:
$ convert image.eps -resize 600 -background Orange label:'Picture' +swap -gravity Center -append image.jpg
This command takes the source EPS image image.eps
, resizes it, puts a text label over the picture, and writes the result into new file image.jpg
. The suffix of output file name specifies that the image must be converted into JPEG format.
To use the ImageMagick preprocessor to do the same, enclose one or more image references in your Markdown source between <<magick>
and </magick>
tags.
<<magick command_params="-resize 600 -background Orange label:'Picture' +swap -gravity Center -append" output_format="jpg">
(leading exclamation mark here)[Optional Caption](image.eps)
</magick>
Use output_format
attribute to specify the suffix of output file name. The whole output file name will be generated automatically.
Use command_params
attribute to specify the string of parameters that should be passed to ImageMagick convert
binary.
Instead of using command_params
attribute, you may specify each parameter as its own attribute with the same name:
<<magick resize="600" background="Orange label:'Picture' +swap" gravity="Center" append="true" output_format="jpg">
(leading exclamation mark here)[Optional Caption](image.eps)
</magick>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file foliantcontrib.imagemagick-1.0.2.tar.gz
.
File metadata
- Download URL: foliantcontrib.imagemagick-1.0.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af558605eb6da8d0a384fe69dc637100de3bbbb8a55a309b4f5d89f545227f15 |
|
MD5 | 43508b020611d7013f3c44ba7bd4a166 |
|
BLAKE2b-256 | e58d9c6b40de4b05e3b12231d3bb98225238e157cf6e9db375cf5b146fafa8ef |
File details
Details for the file foliantcontrib.imagemagick-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: foliantcontrib.imagemagick-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6e03df48d26a5b71a0fc364a21e3ed245d7d8de2f0fa74ea3fbf2e0eb750fc1 |
|
MD5 | 01f930209584b12146ec8aa078b1ff65 |
|
BLAKE2b-256 | 4db007003bc87736282ada3f29742ba02bc5e9ac19a394cf75fbae284886bb5f |