Skip to main content

Create different scaled versions of an image, in webp, jpg, png, svg,... to be used on resposive website

Project description

Pytest

Pypi version Pypi Download

Introduction

responsiveimage is a python package aimed at building responsive version of images.

Supported image format are webp, jpg, png, gif and svg.

Usage

Installation

Run python -m pip install responsiveimage to install the python package.

Also, please install the binaries ffmpeg and optipng (using apt-get, pacman, or directly from sourceforge) to further optimize the png version of the sprite.

Usage

  • resize and save all images in <srcdir> into <dstdir>. New size is 1920px by default (at largest dimension, keep the aspect-ratio), and save quality is:
    • gif and svg: direct copy
    • png: use Pillow library, with Optimize=True
    • jpg: quality=80, progressive, 4:2:2
    • webp: quality=80
    • mp4: use ffmpeg to scale at 1024
python -m responsiveimage --src-dir <srcdir> --dst-dir <dstdir>
  • --export-to-webp: also export the webp version of the image

  • --size <s1,s2...>: different scaling are generating, instead of the default 1920px. In such a case, the created images are suffixed using -size. As an example, using --size 1024,512, an image img.jpg will be rescaled with 1024px and named img-1024.jpg, and another one rescaled at 512px and named img-512.jpg

  • --mp4-as-gif: from a mp4 file, the gif and the webp animated versions are created, using ffmpeg

Releases

1.0

Initial version

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

responsiveimage-1.0.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

responsiveimage-1.0.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file responsiveimage-1.0.0.tar.gz.

File metadata

  • Download URL: responsiveimage-1.0.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for responsiveimage-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c17d55167f7934f607704d485fd0fe69f3e1599af8f60d97f79bd6c78261f10d
MD5 27a97901bea32da18b3b01af4e863c92
BLAKE2b-256 2ef65ab45b2f5a5b46228c6c2bfb6b23fc2636f03e16d55f5b20f698e5526d04

See more details on using hashes here.

File details

Details for the file responsiveimage-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for responsiveimage-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27217b9b5bffe131858d32998f44688adf9c92d1dc93637755237c78f1305ead
MD5 a2edf2e759183a130227263935c8e11f
BLAKE2b-256 4d03ea2e84c4f5b2596386f489d79a3c562e4b0e93dbdf8a7a8989f14d2e5fdd

See more details on using hashes here.

Supported by

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