Skip to main content

A Python script to make pptx files smaller by downscaling images contained inside

Project description

pptx_shrinker

Hey, I can't email this powerpoint!

I was told this. And turns out the issue had been that the images used were raw 4k images. Causing the pptx file to to be 20 MiB despite having only two images in the deck. That was where the idea emerged.

More recently, I encountered a 30 MiB pptx file with 10 images. Only two of the images were going to be shown full screen. The rest were already shrunk to be displayed in only a portion of the slide. Since the slides are 1920/1080, it does not benefit anyone to keep the larger files for display.

Requirements

ffmepg must be installed and accessible via PATH

What does it do?

shrink-pptx input_file.pptx where_to_save_result.pptx

Takes in input_file.pptx, opens it up (using a system temp directory), and examines each image file.

  • If any are over 1920px wide, it downscales them to that resolution (keeping aspect ratio).
  • If any file is now over 2 MiB, it is adjusted to have lower quality of image (same resolution)
  • If that file is still over 2 MiB, it is discarded and the program iteratively downscales until the image is under 2 MiB.
  • If any file is now larger then the original, the original is used.

The resulting image files are placed back the expected locations and the resulting slide deck is saved to where_to_save_result.pptx

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

pptx_shrinker-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

pptx_shrinker-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pptx_shrinker-0.1.1.tar.gz.

File metadata

  • Download URL: pptx_shrinker-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pptx_shrinker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7184f827e76b32b7bc748e8c4031022c29e30bc44be69f3dfe0a9b923eb5eec9
MD5 76eef45e81cd10af9ddea622ba06f846
BLAKE2b-256 58abd423fa66828a07e7e8c8a0c47bb0156b616c972b7ed468b0c3c030e74017

See more details on using hashes here.

Provenance

The following attestation bundles were made for pptx_shrinker-0.1.1.tar.gz:

Publisher: release.yml on mshafer1/py_pptx_shrinker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pptx_shrinker-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pptx_shrinker-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pptx_shrinker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cbf8e5d9eab00df30098b4a942a63e276bf9520ec1ca746cfcaabcb587e24db1
MD5 194369e2bc5d0bf86a45e6a37020e527
BLAKE2b-256 6fc3c4e4220a453b518f37f6591a0bdbdb549cae60ec51e5a1f1e17ae90211c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pptx_shrinker-0.1.1-py3-none-any.whl:

Publisher: release.yml on mshafer1/py_pptx_shrinker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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