https://github.com/foobaz/pngloss Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Skills + GitHub Sponsors + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} foobaz / pngloss Public * Notifications * Fork 2 * Star 36 Lossy compression of PNG images frammish.org/pngloss/ License View license 36 stars 2 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights foobaz/pngloss This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 1 tag Code Latest commit @foobaz foobaz fix typo ... 559f094 Nov 25, 2020 fix typo 559f094 Git stats * 1,200 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time src better use of autotools Sep 25, 2020 suite make s0 lossless again, recompress suite with pngloss s0 Aug 7, 2020 website website example page Sep 26, 2020 .gitignore try all filter types to find best match Jul 13, 2020 COPYRIGHT credit to nagadomi for the website Oct 14, 2020 Makefile.am better use of autotools Sep 25, 2020 Makefile.in better use of autotools Sep 25, 2020 README.md fix typo Nov 25, 2020 compile add automake files for configure Sep 25, 2020 configure better use of autotools Sep 25, 2020 configure.ac better use of autotools Sep 25, 2020 depcomp add automake files for configure Sep 25, 2020 install-sh fix install-sh Sep 25, 2020 missing add automake files for configure Sep 25, 2020 pngloss.1 remove leftover ncolors Sep 5, 2020 View code pngloss Heritage Installation Synopsis Options Examples README.md pngloss Lossily compress your PNG images with pngloss. The program reads the original PNG file and modifies the pixels to make them more compressible. The resulting PNGs are fully backwards compatible with existing PNG decoders. You can use the command line tool on your own machine, or compress images using the interactive website. The compression technique relies on making small adjustments to pixel colors. It works best on true-color images with a wide variety of colors, like photographs or computer generated graphics with realistic lighting. It does not do a good job on paletted images or images with large areas of flat color. Heritage The lossy compression in pngloss is based on an algorithm in Michael Vinther's graphics editor, Image Analyzer. The command line tool is based on Kornel Lesinski's PNG quantization tool, pngquant. Additionally, pngloss includes his work to port the lossy compression algorithm from Go to C as part of his PNG compression suite, ImageOptim. William MacKay brought these pieces together and made improvements to the original compression algorithm, including: * Diffuse color error using Sierra dithering. * Instead of using a static, evenly spaced symbol table (e.g. 0, 20, 40...), pngloss chooses symbols which are more frequent in the original file. * Instead of using only PNG's "average" filter, pngloss tries all five PNG filters for each row, keeping whichever has the best quality/size ratio. * Explicitly tell libpng which filter to use for each row instead of hoping its adaptive filter selection algorithm will choose the correct one. Installation git clone https://github.com/foobaz/pngloss.git cd pngloss ./configure make sudo make install The only dependency is libpng. Synopsis pngloss [options] [...] Options -s, --strength How much quality to sacrifice, from 0 to 85 (default 19). Strength 0 is lossless and does not modify the pixel data, although it may convert colorspace or strip PNG chunks. The maximum is 85 because the algorithm needs at least three symbols to perform well and 256 / 3 ~= 85. One symbol near zero is used for the majority of pixels, plus one positive and one negative to insert when color error builds up enough that they are needed. -b, --bleed Color bleed divider, from 1 to 32767 (default 2). A divider of 1 propagates all of the error from quantization to neighboring pixels, which improves visual quality but also increases filesize. The default of 2 propagates half (1/2) of the error, which is usually a good tradeoff. -v, --verbose Verbose - print additional information about compression. -q, --quiet Quiet - don't print information about compression (the default). -f, --force Force - overwrite existing output image. --no-force Don't overwrite existing output image - overrides an earlier "force" argument. --ext Specify filename extension. Defaults to "-loss.png". Use -f --ext .png to overwrite original files in-place if the original has the extension ".png". --skip-if-larger Don't write compressed image if it's larger than the original. -o, --output Output filename. When this option is given only one input file is accepted. --strip Remove unnecessary chunks (metadata) from input file when writing output. -V, --version Print version number. -h, --help Display usage information. Examples Original -s 20 -s 40 David, original David, s20 David, s40 18kB 7kB (36%) 5kB (23%) Original -s 20 -s 40 Lena, original Lena, s20 Lena, s40 475kB 65kB (13%) 35kB (7%) Original -s 20 -s 40 Tenko, original Tenko, s20 Tenko, s40 234kB 47kB (20%) 30kB (13%) About Lossy compression of PNG images frammish.org/pngloss/ Topics c png png-compression image-compression image-optimization lossy-compression Resources Readme License View license Stars 36 stars Watchers 4 watching Forks 2 forks Releases 1 v1.0 Latest Aug 24, 2020 Contributors 39 * @kornelski * @foobaz * @pdknsk * @sergiomb2 * @craigbarnes * @benkasminbullock * @znerd * @jaalto * @joliss * @rolftimmermans * @toy + 28 contributors Languages * Shell 40.0% * C 30.1% * Makefile 20.6% * Go 5.8% * HTML 1.5% * Roff 1.1% * Other 0.9% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.