A cross-platform PowerShell script that intelligently optimizes PowerPoint presentations by resizing oversized images, applying physical crops, converting inefficient formats, and reducing file sizes--often by 50-95% without visible quality loss.
- Optimize-PptImages
# Analysis only (default - no changes, generates report)
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx"
# Optimize slides (most common)
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -OptimizeSlides
# Optimize with cropping
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -OptimizeSlides -CropSlides
# Full optimization (all slides, masters, layouts, with cropping)
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -All
# Batch process all PPTX files
Get-ChildItem *.pptx | .\Optimize-PptImages.ps1 -OptimizeSlides -CropSlides- Image resizing -- Reduces oversized images to match display size with configurable headroom (default 2x)
- Physical cropping -- Materializes PowerPoint's soft crops into actual image files, removing hidden data
- Format conversion -- Converts PNG->JPEG when transparency isn't needed; converts BMP, TIFF, GIF->JPEG/PNG
- Unreferenced media cleanup -- Removes orphaned files from
ppt/media/
- Transparency analysis -- Detects actual transparent pixels (not just alpha channel presence)
- JPEG quality preservation -- Avoids recompression when source quality is already optimal
- Color profile safety -- Images tagged with a non-sRGB ICC profile (such as AdobeRGB or ProPhoto) or in the CMYK colorspace are converted to sRGB before metadata is stripped, so colors render correctly in PowerPoint after optimization. Plain sRGB and untagged images are not affected.
- Morph transition protection -- Preserves linked images across Morph slide pairs
- Shared image awareness -- Uses maximum display size across all usages
- Minimum savings threshold -- Skip optimizations below configurable savings percentage
- Pipeline input -- Process multiple files via
Get-ChildItem | .\Optimize-PptImages.ps1 - Batch summary -- Aggregated statistics when processing multiple files
- PassThru output -- Return result objects for programmatic use
- Selective processing -- Include or exclude specific slides
- WhatIf/Confirm support -- Preview changes before applying
- Unused layout cleanup -- Removes slide layouts not referenced by any slide, plus masters that become completely unreferenced (opt-in via
-CleanUnusedLayouts). Orphaned add-in parts (think-cell marker tags and OLE objects underppt/tags/ppt/embeddings) that were referenced only by the removed layouts are automatically removed on every run once nothing references them.
- Detailed console output -- Tag-based status indicators with progress
- CSV report -- Per-image statistics for auditing and analysis; includes think-cell discovery so you can see which images are think-cell content and which slides depend on their layouts
- think-cell summary -- When think-cell content is detected, a
[THINK-CELL]console block shows total think-cell size, which layouts carry it, which slides use those layouts, and orphaned add-in parts - Output validation -- Optional post-repack validation via
-ValidateOutput; reports Open XML SDK errors as warnings without aborting the run - Verbose mode -- Detailed logging with
-Verbose
- PowerShell: 7.0 or later (PowerShell Core). Windows PowerShell 5.1 is no longer supported.
- ImageMagick: Version 7.x or later
- DocumentFormat.OpenXml -- required only when using
-ValidateOutput. Install via NuGet. Not needed for any other feature.
| Platform | PowerShell Version | Status |
|---|---|---|
| Windows | PowerShell 7.0+ | Supported |
| macOS | PowerShell 7.0+ | Supported |
| Linux | PowerShell 7.0+ | Supported |
Windows:
# Via Chocolatey
choco install imagemagick
# Or download from https://imagemagick.org/script/download.php#windowsmacOS:
brew install imagemagickLinux (Ubuntu/Debian):
sudo apt update && sudo apt install imagemagickThe tool is a PowerShell module spread across multiple files, so cloning the repository is required.
git clone https://github.com/Rouzax/Optimize-PptImages.git
cd Optimize-PptImagesRunning the tool:
Option A -- run the entry-point script directly (same invocation as always):
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -AllOption B -- import the module and call the exported function directly (useful for scripting and automation):
Import-Module ./Optimize-PptImages.psd1
Invoke-PptImageOptimization -InputPath "presentation.pptx" -AllBoth options accept the same parameters and support pipeline input.
magick --version
pwsh --version| Path | Purpose |
|---|---|
Optimize-PptImages.ps1 |
Thin entry-point script; imports the module and forwards all parameters |
Optimize-PptImages.psm1 |
Module root; dot-sources the src/ files |
Optimize-PptImages.psd1 |
Module manifest |
src/ |
Focused source files (Config, Classes, Common, ImageMagick, Xml, Relationships, Initialization, Structure, Scanning, Morph, Cropping, Optimization, LayoutCleanup, Cleanup, Validation, Reporting, Pipeline) |
src/Public/Invoke-PptImageOptimization.ps1 |
The exported public function |
tests/ |
Pester 5 test suite |
# Analysis only (default - generates report, no image changes)
.\Optimize-PptImages.ps1 -InputPath "MyPresentation.pptx"
# Optimize slides (resize and convert formats)
.\Optimize-PptImages.ps1 -InputPath "MyPresentation.pptx" -OptimizeSlides
# Optimize slides with cropping
.\Optimize-PptImages.ps1 -InputPath "MyPresentation.pptx" -OptimizeSlides -CropSlides
# Full optimization (everything enabled)
.\Optimize-PptImages.ps1 -InputPath "MyPresentation.pptx" -All
# Custom output location
.\Optimize-PptImages.ps1 -InputPath "input.pptx" -OutputPath "output.pptx" -OptimizeSlides
# With verbose logging
.\Optimize-PptImages.ps1 -InputPath "MyPresentation.pptx" -OptimizeSlides -CropSlides -Verbose
# Process only specific slides
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -IncludeSlides 1,5,10 -OptimizeSlides -CropSlides
# Exclude certain slides
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -ExcludeSlides 3,7 -OptimizeSlides
# Custom quality settings
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -OptimizeSlides -HeadroomFactor 1.5 -JpegQuality 90
# Require minimum 10% savings to apply changes
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -OptimizeSlides -MinSavingsPercent 10
# Remove unused layouts and masters
.\Optimize-PptImages.ps1 -InputPath "presentation.pptx" -OptimizeSlides -CropSlides -CleanUnusedLayouts# Process all PPTX files in current directory
Get-ChildItem *.pptx | .\Optimize-PptImages.ps1 -OptimizeSlides -CropSlides
# Process files matching pattern
Get-ChildItem -Path "C:\Presentations" -Filter "Report*.pptx" | .\Optimize-PptImages.ps1 -OptimizeSlides
# Get results for programmatic use
$results = Get-ChildItem *.pptx | .\Optimize-PptImages.ps1 -OptimizeSlides -PassThru
$results | Where-Object { $_.SavingsPercent -gt 50 } | Select-Object InputPath, SavingsPercent
# Preview what would be processed (WhatIf)
Get-ChildItem *.pptx | .\Optimize-PptImages.ps1 -OptimizeSlides -WhatIfBatch Output Example:
============================================================
[STATS] BATCH SUMMARY
============================================================
Files processed: 5
Successful: 5
Total savings:
Original: 245.32 MB
Optimized: 48.76 MB
Saved: 196.56 MB (80.1%)
-Interactive launches a guided wizard for a single file. Use it when you want to inspect what the script would do before committing to a run, or when you want to tune options without constructing a command line by hand.
.\Optimize-PptImages.ps1 -InputPath "deck.pptx" -Interactive-Interactive cannot be combined with pipeline input or a batch input list. Attempting that combination raises an error.
What happens:
-
The script scans the file (read-only, no output written) and prints a findings summary split into two blocks: "Slides" and "Masters & layouts". Each block shows the usage and unique media counts, total media size, format breakdown, resize candidate count, PNG-to-JPEG conversion candidate count, and the top 5 oversized images by oversizing ratio. If more than 5 resize candidates exist, a "+N more" line follows the top-5 list. Source dimensions and opacity are resolved in parallel.
-
You answer a short sequence of questions:
- Operations: yes/no for each of: optimize slides (default ON), optimize masters/layouts, apply crops on slides, apply crops on masters/layouts, remove unused layouts/masters (all default OFF).
- Headroom factor: choose a labeled preset (Smallest file 1.5, Balanced 2.0, Print/HiDPI safe 3.0) or enter a custom value. Default is 2.0.
- JPEG quality: choose a labeled preset (Smaller 80, Balanced 90, High fidelity 95) or enter a custom value. Default is 95.
- Output path: press Enter to accept the derived default, or type a custom path.
- Advanced options (opt-in): if you answer yes, you can set transparency threshold, minimum savings percent, and slide include/exclude lists.
Any flags you pass alongside
-Interactivepre-fill the matching defaults. For example, passing-CropSlidesmakes "Apply crops on slides?" default to YES. -
The wizard displays the equivalent command line and offers four actions:
- [R]un now -- executes the operation immediately, reusing the scan already performed (no second extraction or scan).
- [C]opy & exit -- prints the equivalent command line and exits without writing any files.
- [E]dit an answer -- returns to a section menu (Operations, Headroom/Quality, Output path, Advanced) so you can revise a choice.
- [Q]uit -- exits without writing any files.
| Parameter | Type | Default | Description |
|---|---|---|---|
InputPath |
String | Required | Path to input PPTX/POTX file. Accepts pipeline input. |
OutputPath |
String | <n>.optimized.<ext> |
Path for optimized output file |
MagickPath |
String | Auto-detect | Path to ImageMagick magick executable |
OptimizeSlides |
Switch | $false |
Resize and convert images in slides |
OptimizeMastersAndLayouts |
Switch | $false |
Resize and convert images in master slides and layouts |
CropSlides |
Switch | $false |
Apply physical crops to images in slides |
CropMastersAndLayouts |
Switch | $false |
Apply physical crops to images in master slides and layouts |
CleanUnusedLayouts |
Switch | $false |
Remove slide layouts not used by any slide and masters that become unreferenced. Not included in -All. |
ValidateOutput |
Switch | $false |
Validate the repacked file with the Open XML SDK and report any errors. Non-fatal. Requires the optional DocumentFormat.OpenXml package. Not included in -All. |
All |
Switch | $false |
Enable all optimization and cropping operations |
HeadroomFactor |
Decimal | 2.0 |
Target resolution multiplier (0.5-4.0). 2.0 = 2x display size |
JpegQuality |
Int | 95 |
JPEG quality for compression (1-100) |
TransparencyThresholdPercent |
Decimal | 0.1 |
Minimum transparency % to keep PNG format (0.0-100.0) |
MinSavingsPercent |
Decimal | 0.0 |
Minimum savings % required to apply optimization (0.0-50.0) |
IncludeSlides |
Int[] | None | Only process these slide numbers |
ExcludeSlides |
Int[] | None | Skip these slide numbers |
CsvReportPath |
String | <o>.opt-report.csv |
Path for CSV report file |
PassThru |
Switch | $false |
Return result object(s) to pipeline |
Interactive |
Switch | $false |
Launch an interactive wizard to review findings and configure a run for a single file. Cannot be combined with pipeline or batch input. |
Note: When using -IncludeSlides or -ExcludeSlides, all slides are still analyzed for correct shared image sizing and Morph detection--only the modification is filtered.
PowerPoint stores the full original image regardless of how you resize it on the slide:
- Physical Size: Actual pixel dimensions (e.g., 3840x2160px photo at 2 MB)
- Display Size: How large it appears on slide (e.g., scaled to 400x225px)
If you display a 3840x2160px image at 400x225px, you're storing ~95% unnecessary data.
How PowerPoint Measures Size:
PowerPoint uses EMUs (English Metric Units): 914,400 EMUs = 1 inch. At 96 DPI, 9,525 EMUs = 1 pixel.
When you crop in PowerPoint's UI:
- The entire original image remains embedded
- Crop percentages are stored as XML (
srcRectattributes) - Only the visible portion renders, but all data is stored
With -CropSlides, this script physically removes the cropped portions.
When the same source image is cropped with identical geometry on multiple shapes, the crop is materialized once and the resulting file is shared across all those shapes. Duplicated crops no longer inflate the output file.
The script intelligently converts formats when beneficial:
| Source Format | Conversion | Condition |
|---|---|---|
| PNG | -> JPEG | Transparency < threshold (default 0.1%) |
| BMP | -> JPEG/PNG | Based on transparency analysis |
| TIFF | -> JPEG/PNG | Based on transparency analysis |
| GIF (static) | -> JPEG/PNG | Based on transparency analysis |
| GIF (animated) | Skipped | Would break animation |
Transparency Analysis: The script counts actual transparent pixels, not just alpha channel presence. A PNG with an alpha channel but no actual transparency gets converted to JPEG.
When the optimize phase strips image metadata (EXIF, comments, and embedded profiles), it first checks the color profile of every image it processes:
- Non-sRGB or CMYK: If an image carries a non-sRGB ICC profile (for example AdobeRGB, ProPhoto, or any custom print profile) or is in the CMYK colorspace, the script converts it to sRGB before stripping. This is done by passing
-profile <bundled sRGB.icc>to ImageMagick immediately before-strip, so the color values in the output file match what you see in PowerPoint. - Plain sRGB or untagged: No conversion happens. The strip removes the profile tag as before. Colors are already in the display colorspace, so nothing changes visually.
- Crop phase: The crop phase does not use
-strip, so ICC profiles are preserved intact during cropping regardless of colorspace.
Most slide content (screen captures, web-downloaded photos) is already sRGB, so this change has no visible effect on those images.
PowerPoint can share a single media file across multiple slides. When you copy-paste an image between slides, they reference the same file.
Optimization Implications:
- The script tracks the largest display size across all usages
- All instances benefit from a single optimized file
- Cropped shared images are handled carefully
Best Practice: Copy-paste images between slides (don't re-insert from disk) to leverage sharing.
PowerPoint's three-tier hierarchy:
- Slide Masters -- Top-level templates
- Slide Layouts -- Layout templates based on masters
- Slides -- Actual content based on layouts
By default, the script skips master/layout images to avoid widespread changes. Enable with:
-OptimizeMastersAndLayouts-- Resize and convert formats-CropMastersAndLayouts-- Apply physical crops
Corporate templates often accumulate dozens or hundreds of unused layouts from merged or inherited slide masters. The -CleanUnusedLayouts switch removes layouts not referenced by any slide, along with any masters that have no remaining layouts. This is opt-in and not included in -All, since it reduces the layout gallery available when creating new slides.
The script detects Morph transitions and:
- Identifies linked image pairs across consecutive slides
- Prevents conflicting crops that would break animations
- Ensures synchronized optimization of paired images
[FILE] Processing file 1: Test Deck.pptx
[SCAN] Analyzing presentation structure...
File: D:\Temp\PowerPoint\Test Deck.pptx
[STATS] Found 28 image usages
[STATS] Across 19 unique images
[LINK] Morph detection: 2 transition(s), 2 image pair(s) linked
[NOTE] Corrected illegal crop values for 'Picture 3' on Slide 20 (r:-12038->0, b:-182512->0)
[CROP] Processing image crops...
[BLOCK] Morph crop conflict for 'Picture 3' across Slide 18 <-> 17 (skipping crop & optimization)
[STATS] Cropping phase complete: 6 cropped, 3 skipped
[PROC] Optimizing images...
[SKIP] 'Picture 5' on Slide 3: has a soft crop -- add -CropSlides to materialize it first
[STATS] Optimization phase complete: 12 optimized, 10 skipped
[CLEAN] Cleaning up unreferenced media...
[CLEAN] Media files removed: 4
[PACK] Repacking presentation...
[OK] Repacked: 6557.56 KB
[DONE] Optimization Complete
[STATS] Images cropped: 6
[STATS] Images optimized: 11
[SIZE] File size:
Original: 62.17 MB
Optimized: 6.40 MB
Saved: 55.76 MB (89.7%)
[SAVE] Saving output files...
[OUT] Output: D:\Temp\PowerPoint\Test Deck.optimized.pptx
[OUT] Report: D:\Temp\PowerPoint\Test Deck.optimized.opt-report.csv
By default, routine per-image detail ([OK], [CONV], [INFO] lines showing savings percentages) and per-image crop detail ([CROP] success lines) are suppressed. To see them, add -Verbose.
Items that require your attention still appear at normal verbosity. [SKIP] lines with a suggested flag (for example, "add -CropSlides") are shown in gray so you can see which images were skipped and why.
Phase-level headers ([PROC] Optimizing images...) and summary statistics ([STATS] Optimization phase complete: ...) are always shown.
Full per-image detail is always recorded in the CSV report regardless of verbosity level.
| Tag | Meaning |
|---|---|
[FILE] |
Processing file (batch mode) |
[SCAN] |
Analysis phase |
[STATS] |
Statistics/counts |
[LINK] |
Morph transition detection |
[CROP] |
Cropping operation |
[PROC] |
Optimization phase |
[CONV] |
Format conversion (PNG->JPEG, BMP->JPEG, etc.) |
[NOTE] |
Corrections (illegal crop values, removed no-op crop) |
[SKIP] |
Skipped operation |
[INFO] |
Info/notes (transparency detection, kept original) |
[BLOCK] |
Blocked operation (Morph conflict, safety) |
[CLEAN] |
Cleanup operation |
[PACK] |
Repacking presentation |
[CSV] |
Generating CSV report |
[OK] |
Success |
[DONE] |
Completion |
[SIZE] |
File size information |
[SAVE] |
File save operation |
[OUT] |
Output file paths |
[WARN] |
Warning |
[ERROR] |
Error |
Each run generates a detailed CSV report with these columns:
| Column | Description |
|---|---|
Location |
Where the image appears (e.g., "Slide 5", "Layout (slideLayout1.xml)") |
ContextType |
Type: Slide, Layout, Master, Notes, or Handout |
SlideNumber |
Slide number (0 for masters/layouts) |
SlideModified |
Whether the slide XML was modified |
ShapeName |
PowerPoint shape name (e.g., "Picture 3") |
IsThinkCell |
Yes if the shape is think-cell content (by shape name), else No |
UsedOnSlides |
For Layout/Master rows, the slide numbers that use this layout/master ((none) if unused); blank for Slide rows |
MediaPart |
Path of the media file inside the package (e.g., ppt/media/image16.emf) |
SourceWidthPx / SourceHeightPx |
Original image dimensions |
DisplayWidthPx / DisplayHeightPx |
Display dimensions on slide |
TargetWidthPx / TargetHeightPx |
Target dimensions after headroom factor |
OriginalFile |
Original media filename |
OptimizedFile |
Filename after optimization (may change if format converted) |
BeforeSizeBytes / AfterSizeBytes |
File sizes |
Savings |
Human-readable savings (e.g., "443.4 KB (93.0%)") |
HasSrcRect |
Whether PowerPoint crop was present |
CropApplied |
Whether physical crop was applied |
CropNormalized |
Whether illegal crop values were corrected |
CropRemovedNoOp |
Whether a no-op crop (>=98% visible) was removed |
SvgFallback |
Whether this is an SVG fallback image |
OptimizationStatus |
Result status (see below) |
WhyNotOptimized |
Reason if skipped |
HeadroomFactor |
Headroom factor used |
JpegQuality |
JPEG quality setting used |
SourceJpegQuality |
Original JPEG quality (for JPEG sources) |
TransparencyThresholdPercent |
Transparency threshold used |
EffectiveTransparencyPercent |
Actual transparency detected |
MinSavingsPercent |
Minimum savings threshold used |
ManualActionRequired |
Whether manual intervention is recommended |
ManualActionHint |
Suggested action |
Sort Order: Rows are sorted by context type (Slides first, then Layouts, then Masters), then by slide number, then by layout/master number. This follows presentation order for easy reference.
Optimization Status Values:
| Status | Description |
|---|---|
ConvertedPngToJpeg |
PNG converted to JPEG (no significant transparency) |
ConvertedToJpeg |
BMP/TIFF/GIF converted to JPEG |
ConvertedToPng |
TIFF/GIF converted to PNG (has transparency) |
OptimizedPngAlpha |
PNG optimized while preserving transparency |
OptimizedJpeg |
JPEG resized/recompressed |
NoChangeNeeded |
Already at target size |
Skipped_AlreadyOptimal |
Already at target size and quality |
Skipped_SlidesFlagMissing |
In slide; enable -OptimizeSlides |
Skipped_TemplatesFlagMissing |
In master/layout; enable -OptimizeMastersAndLayouts |
Skipped_CropNotMaterialized |
Has crop; enable -CropSlides or -CropMastersAndLayouts |
Skipped_MorphCropConflict |
Morph transition with conflicting crops |
Skipped_SvgFallback |
SVG fallback PNG; PowerPoint regenerates |
Skipped_UnsupportedFormat |
Unsupported format (EMF, WMF, SVG) |
Skipped_AnimatedGif |
Animated GIF; conversion would break animation |
Skipped_NoNetSavings |
No savings achieved or below threshold |
When running via Optimize-PptImages.ps1, the script reads the resolved exit code from the module and calls exit after the function returns, so the exit code propagates to the calling shell as normal.
When calling Invoke-PptImageOptimization directly after importing the module, the function does not call exit. The caller's process continues normally. The resolved exit code is stored in $script:LastFinalExitCode inside the module scope if you need to inspect it programmatically.
| Code | Meaning |
|---|---|
0 |
Success with changes applied |
1 |
Error occurred |
2 |
Success but no changes needed |
.\Optimize-PptImages.ps1 -InputPath "Test Deck.pptx"| Metric | Value |
|---|---|
| Original | 63.91 MB |
| Optimized | 63.84 MB |
| Saved | 75 KB (0.1%) |
| Images cropped | 0 |
| Images optimized | 0 |
Savings from repack only. All images reported as skipped with hints for which flags to enable.
.\Optimize-PptImages.ps1 -InputPath "Test Deck.pptx" -OptimizeSlides| Metric | Value |
|---|---|
| Original | 63.91 MB |
| Optimized | 56.59 MB |
| Saved | 7.32 MB (11.5%) |
| Images cropped | 0 |
| Images optimized | 5 |
Images with crops are skipped until -CropSlides is enabled.
.\Optimize-PptImages.ps1 -InputPath "Test Deck.pptx" -OptimizeSlides -CropSlides| Metric | Value |
|---|---|
| Original | 63.91 MB |
| Optimized | 34.90 MB |
| Saved | 29.01 MB (45.4%) |
| Images cropped | 5 |
| Images optimized | 9 |
.\Optimize-PptImages.ps1 -InputPath "Test Deck.pptx" -All| Metric | Value |
|---|---|
| Original | 63.91 MB |
| Optimized | 6.56 MB |
| Saved | 57.35 MB (89.7%) |
| Images cropped | 6 |
| Images optimized | 12 |
- Resize images before inserting -- Don't insert 4000x3000px photos for 400x300px display
- Crop in image editor -- Don't rely on PowerPoint's soft crop
- Choose right format -- Photos->JPEG, transparency->PNG, vectors->SVG
- Copy-paste images -- Don't re-insert same image from disk (enables sharing)
- Inheriting poorly-optimized presentations from others
- Batch processing legacy presentations
- Automated workflows where manual optimization isn't feasible
- Recovering from "quick deadline" work
- Applying accumulated soft crops
- Print-quality presentations requiring high DPI (>220 PPI)
- Intentional oversizing for zoom effects
- Already well-optimized files
- When you need original high-res images preserved
| Item | Reason |
|---|---|
| Embedded videos | Only processes images |
| Embedded fonts | Not optimizable |
| SVG files | Vector format (no raster optimization) |
| EMF/WMF graphics | Vector formats (common in think-cell, Excel objects) |
| Audio files | Not processed |
| SmartArt | Rendered as vectors |
- SVG Fallbacks: PowerPoint auto-generates PNG fallbacks for SVGs. The script skips these as PowerPoint regenerates them.
- Animated GIFs: Skipped to preserve animation.
- Shared Image Sizing: Uses largest display size across all usages.
- Illegal Crop Correction: Automatically corrects invalid (negative) crop values.
- JPEG Quality Detection: Avoids recompression if source quality <= target.
Always keep a backup. Optimization is lossy (especially JPEG compression). Original high-resolution images cannot be recovered.
- Install ImageMagick (see Installation)
- Ensure
magickis in your PATH - Restart terminal/PowerShell
- Or use
-MagickPath "C:\Path\To\magick.exe"
- Close PowerPoint before running
- Ensure file isn't open elsewhere
- Check file permissions
The script checks file accessibility before processing. If locked:
- Close the output file
- Check console for temporary file locations
Possible causes:
- Unusual XML structure in original
- Disk space issues
- PowerPoint version incompatibility
Solutions:
- Run with
-Verbosefor details - Check available disk space
- Report issue with sample file
If optimized file is larger:
- Original was already well-optimized
- Images were at/below target sizes
- Run with
-Verboseto see what was skipped
| Deck Size | Typical Time |
|---|---|
| Small (10 slides, 5 images) | 10-20 seconds |
| Medium (50 slides, 30 images) | 1-2 minutes |
| Large (100 slides, 100 images) | 3-5 minutes |
Image probing (transparency analysis, JPEG quality detection), image cropping, and the ImageMagick resize/convert work all run in parallel across CPU cores. Decks with many images benefit the most from this; the improvement scales with core count.
- Peak memory: ~500MB-1GB depending on image sizes
- Temp disk space: Up to 2x original file size
- Cleanup: Automatic on completion or error
Include:
- PowerShell version:
$PSVersionTable - ImageMagick version:
magick --version - Operating system
- Sample PPTX (if possible)
- Full console output with
-Verbose
- ImageMagick for high-quality image processing
- PowerPoint Open XML format documentation
Remember: This script rescues bloated presentations and automates best practices--but the best optimization is careful design from the start. Size images appropriately, choose the right formats, crop before inserting, and reuse via copy-paste.