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.3.tar.gz (3.8 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.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pptx_shrinker-0.1.3.tar.gz
  • Upload date:
  • Size: 3.8 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.3.tar.gz
Algorithm Hash digest
SHA256 35eb18ba8edee32970b0f45667261445170305e0c1c803a229ec6defbb1d454e
MD5 571ce38541062893eb00a60cad190e82
BLAKE2b-256 b4f4995ce4e56e531291e7dc77074dbbde1251ffc82eb02aa2a4a4992a2bf933

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pptx_shrinker-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 914a1a4f626184824ccb363641ce1b0e322d2d83eac7560602f8a1e65559a376
MD5 39bba7ad599ad77c7c92ff2874077a04
BLAKE2b-256 2d9fbf8339d8558a9bbea30fc73b87bb62d4f3fb2a0fc537a00edd76b62893af

See more details on using hashes here.

Provenance

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