Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Compress a PPTX or POTX file, converting all PNG/TIFF images to lossy JPEGs.
When copy-pasting images to PowerPoint presentations, these sometimes get inserted as lossless versions, blowing up the size of the presentation.
This script takes all PNG or TIFF images part of the presentation which are larger than a given threshold (1 MiB by default), converts them to a lossy JPEG variant, and creates a new PPTX file.
:warning: This is not the same as compressing images with PowerPoint's own functionality. You may still need to do this to reduce the size of your presentation!
PNGs containing transparency can be skipped to prevent graphics issues. Normally their transparent parts are replaced with white (although you can choose another color).
magick
commands (magick convert
and magick identify
)ffmpeg
for media files, andUnder Ubuntu, get ImageMagick via:
apt install imagemagick
Under macOS, install it with Homebrew:
brew install imagemagick
For ffmpeg, use the static builds from ffmpeg.org.
Via pip:
pip3 install --user compress-pptx
Call compress-pptx
and point it to a PPTX or POTX file. It'll compress the images and output another compressed file next to it.
For more options, see the -h
output:
usage: compress-pptx [-h] [-o OUTPUT] [-s SIZE] [-q QUALITY] [-t TRANSPARENCY]
[-k] [-v] [-f] [-m] [-j] [-l] [--num-cpus NUM_CPUS]
input
positional arguments:
input
options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output file (default: None)
-s SIZE, --size SIZE Minimum size threshold in bytes. Also accepts the
suffixes k/M/G or KiB/MiB/GiB (default: 1MiB)
-q QUALITY, --quality QUALITY
JPEG output quality (0-100) (default: 85)
-t TRANSPARENCY, --transparency TRANSPARENCY
Replace transparency with color (default: white)
-k, --skip-transparent-images
Skip converting transparent images at all (default:
False)
-v, --verbose Show additional info (default: False)
-f, --force Force overwriting output file (default: False)
-m, --compress-media Compress other media types such as audio and video
(requires ffmpeg) (default: False)
-j, --recompress-jpeg
Recompress jpeg images (default: False)
-l, --use-libreoffice
Use LibreOffice to compress EMF files (only way to
compress EMF files under Linux) (default: False)
--num-cpus NUM_CPUS Number of CPUs to use (default: all available CPUs)
There's an unmaintained Bash version under bash/compress-pptx.sh
.
caydey 💻 |
MIT License
Copyright (c) 2021-2023 Werner Robitza
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Bump requirement to python 3.8.
Docs: add @caydey as a contributor.
Update README and minor code changes.
Added '-l' to compress emf files using libreoffice.
Fixed bug for when file compression fails.
Fixed bug with clashing variable names.
Refractored "image" to "file"
Media file compression and recompress jpeg files.
Allow POTX files, fixes #4.
Fallback to 'convert' and 'identify', fixes #3.
Auto-formatting.
Add -f/--force parameter.
Update gitignore.
Add defaults to CLI options.
Update badge link.
Improve setup.py.
Remove release script.
Format setup.py and switch to markdown.
Add warning.
Update badge URL.
Better error handling; check for magick command.
Add badge to readme.
Fix README.
Add changelog.
Switch to python package.
Various updates, v0.2.
Add TODO notice.
Handle input errors.
Update instructions, add script.
Add script and README.
Initial commit.
FAQs
Compress images in PPTX files
We found that compress-pptx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.