MkDocs plugin to resize images according to the configuration.
Project description
MkDocs Resize Images Plugin
This MkDocs plugin finds all folders with a certain name, by default assets-large
, resizes all images in those folders according to the plugin configuration.
Then saves the resized images in a different folder, by default assets
.
The plugin also supports caching: if a file has not changed since the last time the plugin ran, it won't be processed again.
Installation
Install the plugin using pip from PyPI:
pip install mkdocs-resize-images
Activate the plugin in mkdocs.yml
:
plugins:
- search
- resize-images
Create .gitignore
file in your project root directory and add the following line to it:
assets-large # or whatever you have set as source-dir
.resize-hash # if you have enabled caching
Usage
By default, the plugin will look for images in all directories named assets-large, resize them to 800x600 pixels, and then save the resized images in assets directories in the same parent directories as the assets-large directories.
You can configure the plugin in your mkdocs.yml:
plugins:
- search
- resize-images:
source-dir: assets-large
target-dir: assets
enable_cache: True
size: [800, 600]
extensions: ['.jpg', '.jpeg', '.png', '.gif', '.svg']
source-dir
: The name of the directories to search for images to resize. Default is assets-large
.
target-dir
: The name of the directories to save the resized images in. Default is assets
.
size
: The size to resize the images to, specified as [width, height]. Default is [800, 600]
.
extensions
: List of image file extensions to consider for resizing. The plugin will look for images with these extensions in both lower and upper case. Default is ['.jpg', '.jpeg', '.png', '.gif', '.svg']
.
enable_cache
: Whether to enable caching. If enabled, the plugin will check if a file has changed since the last time the plugin ran, and if not, it won't process the file again. Default is True
.
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
Hashes for mkdocs-resize-images-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e83e96c11e2dd1b8b2104b699462523810cf9ad905f139a90f466724af85228 |
|
MD5 | 766537a3d2c36047066f3c21fec094e2 |
|
BLAKE2b-256 | 789f236199d8069443685a9be2c7368aae7b22b67ded82c60b65c3729e7a0462 |
Hashes for mkdocs_resize_images-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 888a54eca3e3881d9cd4439a93a4a16ea545244708df5a8569f7e0d329c3ad79 |
|
MD5 | dded0899fd9d468bb31a4613fd97df71 |
|
BLAKE2b-256 | 9f724848a14d120e43424b7e6d08fd70b4b7e3ec3172a90994c4252e134ffc09 |