make-responsive-images
Generate responsive images automatically, for websites to use srcset
and sizes
in the <img>
tags.
This way you serve an optimal image for each device viewport size.
Installation
pip install make-responsive-images
Usage
resize [OPTIONS] COMMAND [ARGS]...
Options
-v, --version
: Show the application's version and exit.--help
: Show this message and exit.
Commands
image
: Resize one image
Usage
resize image [OPTIONS] [IMAGE]
Arguments
[IMAGE]
: [default: /workspace/tests/fixtures/xfer-original.jpg]
Options
--widths TEXT
: Widths of new images, in pixels [default: 500,1000,1500,2000,2500]--html / --no-html
: Generate HTMLtag [default: True]
--classes TEXT
: Classnames to add to thetag (e.g. class="img-fluid")
--img-sizes TEXT
: Sizes for thetag (e.g. sizes="100vw") [default: 100vw]
--lazy / --no-lazy
: Adds loading="lazy" totag for SEO [default: False]
--alt TEXT
: Adds alt="" to thetag (e.g. alt="Funny image") [default: ]
--dir TEXT
: Images directory to prepend to the src (e.g. src="dir/images")--fmt TEXT
: Image type to save as ("jpg" and "webp" supported) [default: webp]--qual INTEGER
: Compression to apply (i.e. 0=max, 100=min) [default: 100]--lower / --no-lower
: Converts filename to lowercase [default: True]--dashes / --no-dashes
: Converts underscores to dashes for SEO [default: True]--flask / --no-flask
: Uses Python Flask's 'url_for('static', ...)' [default: False]--help
: Show this message and exit.
Author Info
Sean McCarthy is Chief Data Scientist at IJACK Technologies Inc, a leading manufacturer of fully-automated pumps to green the oil and gas industry.