Skip to main content

pil_resize

Project description

pil_resize

PyPI - package version PyPI - license PyPI - python version PyPI - downloads

GitHub - last commit GitHub - commit activity

GitHub - code size in bytes GitHub - repo size GitHub - lines of code

GitHub - license

Description

Resize/paste images easily keeping their aspect ratio

Install

pip install pil_resize_aspect_ratio
# or
pip3 install pil_resize_aspect_ratio

Usage

from pil_resize_aspect_ratio import Resizer, FillType

p_org_img_bg  = 'bg.png'
p_overlay_img = 'fg.png'
path_out = 'final.png'

resized_bg_image = Resizer.resize_keep_aspect_ratio(
    image=p_org_img_bg,
    fill_type=FillType.Fill,
    target_size=(1920, 1080),
    return_image_instead_of_success=False
)

print(
    Resizer.paste_and_fit(
        background_image=resized_bg_image,
        foreground_image=p_overlay_img,
        path_out=path_out
    )
)

Dependencies

noraise, Pillow

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

pil_resize_aspect_ratio-0.0.8.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

pil_resize_aspect_ratio-0.0.8-py3-none-any.whl (4.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