Skip to main content

SmilePngquant

That is a bridge of pngquant for python3

What's new 1.1.1

  • add default pngquant sdk path in constructor
  • verify pngquant sdk path

Download

Find package

Or build from github

git clone --recursive git://github.com/kornelski/pngquant.git
cd pngquant
make
sudo make install

Find

which pngquant

$ /usr/local/bin/pngquant

Check version

pngquant --version

$ 2.17.0 (September 2021)

Start to code

from smilepngquant.PNGQuant import PNGQuant

# initialize
smile    = PNGQuant()
or
smile    = PNGQuant('/usr/local/bin/pngquant')

*** by default the application located in /usr/local/bin/pngquant

*** it's able to set to another location via

smile.setPngQuant(path= '/home/winny/pngquant')

test a filename

quality value starts 20 to 100, and it's integer

smile.compress(
  filename  = '/home/thyda/Download/kara.png'
  , quality = 80
)

verify before use

if smile.isError():
  print(f'Everything is okay, the file name is: {smile.getFilename()}')

else:
  print(f'{smile.getErrorMessage()}')

Options

  • dirname: can be None set coy to a new directory for the new file

  • newFilename: can be None set a new copy name

Both can set any value, or None, or one of them.

Let check the example:

Ex 1

smile.compress(
  filename      = '/home/thyda/Download/kara.png'
  , quality     = 80
  # move to new directory
  , dirname     = '/home/thyda/Document/'
  , newFilename = 'jojo'
)

Ex 2

smile.compress(
  filename      = '/home/thyda/Download/kara.png'
  , quality     = 80
  # move to new directory
  , dirname     = '/home/thyda/Document/'
)

Ex 3

smile.compress(
  filename      = '/home/thyda/Download/kara.png'
  , quality     = 80
  # move to new directory
  , newFilename = 'jojo'
)

It is also available on https://pypi.org/project/smilepngquant
To Support my work, please donate me via Buy me a PizzaBuy me a Coffee

Metadata

Release files for smilepngquant 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smilepngquant 1.1.0
File Size Uploaded Provenance Actions
smilepngquant-1.1.0.tar.gz 5.1 kB Without provenance Details for smilepngquant-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smilepngquant 1.1.0
File Interpreter ABI Platform Actions
smilepngquant-1.1.0-py3-none-any.whl Python 3 none any Details for smilepngquant-1.1.0-py3-none-any.whl

Total release size: 10.6 kB

Release files / smilepngquant-1.1.0.tar.gz

Download URL smilepngquant-1.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e33b32e6d1e53f1217f6f377c281eb5f62aa282bbf67fe202528d992637592b1
BLAKE2b-256 checksum
How to use checksums
2be1c3b8f26334ef10caa36f1b44d5b618f1d175434952da12876bd38cbc5f47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / smilepngquant-1.1.0-py3-none-any.whl

Download URL smilepngquant-1.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
845065c08cc2f6d18b00ccf99d2daa7fad3aed0813a309d145c1fdca36cbd303
BLAKE2b-256 checksum
How to use checksums
7ec5a28112d597dbb2079cf102869389e843af5711c5d7484d3870f57b29701a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Security for smilepngquant 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page