PNGOptimizerMBS class

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

PNGOptimizerMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Pictures Import and Export MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This class is a wrapper for the OptiPNG command line tool.
Example
dim p as Picture = LogoMBS(500)

dim fi as FolderItem = SpecialFolder.Desktop.Child("test unoptimized.png")
if not fi.SaveAsPNGMBS(p,0) then
MsgBox "Failed to save PNG file."
Return
end if

dim fo as FolderItem = SpecialFolder.Desktop.Child("test optimized.png")
fo.Delete // delete if existed before

dim o as new PNGOptimizerMBS

o.YieldTicks=10 // give time for other threads
o.InputFile=fi
o.OutputFile=fo

if o.Optimize then
MsgBox "OK: Saved "+str(o.BytesSaved)
fo.Launch
else
MsgBox "failed"
end if

OptiPNG: Advanced PNG optimization program.
http://optipng.sourceforge.net/

Copyright (C) 2001-2008 Cosmin Truta.
OptiPNG is open-source software, and is distributed under the same licensing and warranty terms as libpng.

PNG optimization is described in detail in the PNG-Tech article "A guide to PNG optimization"
http://www.cs.toronto.edu/~cosmin/pngtech/optipng.html

The idea of running multiple compression trials with different PNG filters and zlib parameters is inspired from the pngcrush program by Glenn Randers-Pehrson.
The idea of performing lossless image reductions is inspired from the pngrewrite program by Jason Summers.

This class has no sub classes.

Some examples using this class:

Blog Entries

Release notes


The items on this page are in the following plugins: MBS Images Plugin.


PKeyMBS   -   PNGpictureMBS


💬 Ask a question or report a problem