-
Notifications
You must be signed in to change notification settings - Fork 0
experimental epub EBook optimizer (to make the epub file smaller)
suglasp/pwsh_epub_optimizer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PowerShell epub EBook optimizer -=============================- Utility script that can read a ebook epub file and try to compress the images a bit more, so the total epub file gets smaller. ! Does not work on epub files containing .gif and .svg files. ! ! Only epub files containing .jp(e)g images are supported. ! ! Png file optimizations are experimental ! Usage: .\epub_ebook_optimizer.ps1 <path\myebookfile.epub> # single argument is the same as providing arg -epub <path\myebookfile.epub> .\epub_ebook_optimizer.ps1 -epub <path\myebookfile.epub> [-limit <size as bytes>] [-compression <0..100 as procent>] Version History: 14/11/2021 : First versions. Made a few tweaks to it in the same day. Last version was in fact non-working, because i commented out the Optimization method for debugging reasons, and forgot te re-enable the method when pushed to repo. 15/11/2021 : Created a more optimized and efficiënt version (not in terms of speed, but in optimizing the end result epub file). 16/11/2021 : Preperations for converting .png files to .jpg. Lowered the default size for epub archive files from 100Mb to 98Mb. 17/11/2021 : Created version that can handle .png files (converts files to .jpg format). 20/11/2021 : Small improvements Cleanup temporary leftover files at startup, if script would be early aborted by the user. 21/11/2021 : Discovered a bug in the xhtml that is not replaced in the optimized .epub archive. 17/05/2024 : Found that some epub files OPF XML data, contained a corrupted or incorrect DTD. Tips & tricks: - Loop trough a folder and optimize epub files in bulk PS C:\epub_tool> $files = @(Get-ChildItem -Path C:\SomePathWithFiles -Filter *.epub) PS C:\epub_tool> $files | % { .\epub_ebook_optimizer.ps1 $_.FullName } - The script shows "WARNING: [!] No epub action needed! Size is okay." Always check you use absolute paths instead of relative paths. For example, dot sourced paths in Powershell will not work. PS C:\epub_tool> .\epub_ebook_optimizer.ps1 .\MyEBookFile.epub # will not work PS C:\epub_tool> .\epub_ebook_optimizer.ps1 "C:\epub_tool\MyEBookFile.epub" # does work
About
experimental epub EBook optimizer (to make the epub file smaller)