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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7184f827e76b32b7bc748e8c4031022c29e30bc44be69f3dfe0a9b923eb5eec9
|
|
| MD5 |
76eef45e81cd10af9ddea622ba06f846
|
|
| BLAKE2b-256 |
58abd423fa66828a07e7e8c8a0c47bb0156b616c972b7ed468b0c3c030e74017
|
Provenance
The following attestation bundles were made for pptx_shrinker-0.1.1.tar.gz:
Publisher:
release.yml on mshafer1/py_pptx_shrinker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pptx_shrinker-0.1.1.tar.gz -
Subject digest:
7184f827e76b32b7bc748e8c4031022c29e30bc44be69f3dfe0a9b923eb5eec9 - Sigstore transparency entry: 1194671857
- Sigstore integration time:
-
Permalink:
mshafer1/py_pptx_shrinker@b79bb80e2e6e7c50179de6b95651a422a89b87a3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mshafer1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b79bb80e2e6e7c50179de6b95651a422a89b87a3 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbf8e5d9eab00df30098b4a942a63e276bf9520ec1ca746cfcaabcb587e24db1
|
|
| MD5 |
194369e2bc5d0bf86a45e6a37020e527
|
|
| BLAKE2b-256 |
6fc3c4e4220a453b518f37f6591a0bdbdb549cae60ec51e5a1f1e17ae90211c9
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pptx_shrinker-0.1.1-py3-none-any.whl -
Subject digest:
cbf8e5d9eab00df30098b4a942a63e276bf9520ec1ca746cfcaabcb587e24db1 - Sigstore transparency entry: 1194671869
- Sigstore integration time:
-
Permalink:
mshafer1/py_pptx_shrinker@b79bb80e2e6e7c50179de6b95651a422a89b87a3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mshafer1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b79bb80e2e6e7c50179de6b95651a422a89b87a3 -
Trigger Event:
release
-
Statement type: