That is a bridge of pngquant for python3
Project description
SmilePngquant
That is a bridge of pngquant for python3
Download
Find package
- https://pkgs.org/download/pngquant
- Ex: https://ubuntu.pkgs.org/20.04/ubuntu-universe-amd64/pngquant_2.12.2-1_amd64.deb.html
- This document will cover
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()
# 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.
smile.compress(
filename = '/home/thyda/Download/kara.png'
, quality = 80
# move to new directory
, dirname = '/home/thyda/Document/'
)
It is also available on https://github.com/sitthykun/smilepngquant
To Support my work, please donate me via Buy me a Coffee
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smilepngquant-0.0.5.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for smilepngquant-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e7d3cf56eed53aafaf893f40eca90f3c74ed9d42c6e1fedae43745eca165c8 |
|
MD5 | 50c398254727648fa02e09e023797c57 |
|
BLAKE2b-256 | 50c67630467f5b45e27f92d06236c5ae10bc60e7f444a074c53348ce5bd8f2dd |