Skip to main content

A filter to print the input image in different predefined image sizes.

Project description

image-filter

PyPI version Downloads Linting Python package Upload Python Package MIT License

A Lektor filter to print the input image in different predefined image sizes.

This plugin is designed to work together with the lektor-image-resize Plugin.

Current Filters:

  • webpimagesizes will print the configured webp image sized based on the input file name.
  • jpgimagesizes will print the configured jpg image sized based on the input file name.

Configuration

You can configure the image width in the config file called configs/image-resize.ini and add a few sections for images. The section names can be whatever you want, the final images will be called $(imagename)-$(sectionname).jpg and $(imagename)-$(sectionname).webp.

If the max_width enty does not exist the entry will be ignored.

Here is a example config file:

[small]
max_width = 512

[medium]
max_width = 900
max_height = 900

[woowee]
max_width = 1440

Example Output

Lektor Jinja2 Input

<img {{ 'waffle.jpg'|webpimagesizes }} />

Lektor HTML Output:

<img src="waffle-small.webp" width="512"
  srcset="waffle-small.webp  512w,
          waffle-medium.webp 900w,
          waffle-woowee.webp 1440w," />

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lektor-image-filter-0.8.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

lektor_image_filter-0.8-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page