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.2.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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pptx_shrinker-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4439d03a4aa03b6db5b75292f4ebf2f5603acc9b2c18483a6a80d348dc0cf708
MD5 ccf0dbd2ebff58cf911e057ef6dd13eb
BLAKE2b-256 2febcc5c4d8e188380352fccc6a584615c1528a1541d391d1442c8aed7c42411

See more details on using hashes here.

Provenance

The following attestation bundles were made for pptx_shrinker-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: pptx_shrinker-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8bacb842b0117f524385f617ece61c12e1b4a999d73049ffc39c707a576b9095
MD5 330dbbfcac5aa2819bc51e856f43e406
BLAKE2b-256 78f1ee1eaf7939eefcb27e3dd5e226605fbef224f6e6b0d5d19f8ce875fc586a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pptx_shrinker-0.1.2-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