Webp image library for python3.
Project description
smilewebp
The first version 1.0.0.
Webp image library for python3.
Download
Find package
Install directly in Ubuntu
Find
which cwebp
$ /usr/bin/cwebp
Check version
cwebp -version
$ 0.6.1
Start to code
from smilewebp.Webp import Webp
# initialize
smile = Webp()
or
smile = Webp('/usr/bin/cwebp')
*** by default the application located in /usr/bin/cwebp
*** it's able to set to another location via
smile.setWebp(path= '/usr/bin/cwebp')
test a filename
quality value starts 20 to 100, and it's integer
smile.compress(
filename = '/home/pseth/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.convert(
filename = '/home/pseth/Download/kara.png'
, quality = 100
# move to new directory
, dirname = '/home/pseth/Document/'
, newFilename = 'jojo'
)
Ex 2
smile.convert(
filename = '/home/pseth/Download/kara.png'
, quality = 100
# move to new directory
, dirname = '/home/pseth/Document/'
)
Ex 3
smile.convert(
filename = '/home/pseth/Download/kara.png'
, quality = 100
# move to new directory
, newFilename = 'jojo'
)
It is also available on https://pypi.org/project/smilewebp
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
smilewebp-1.0.0.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for smilewebp-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 738e17e24afd7f961ca1a2b1ab38a95b9892b3e950330fdbab4e54cd75085ef3 |
|
MD5 | 3e2b8583afc0a5be62f071c5490b41b1 |
|
BLAKE2b-256 | 3fce7aa07126d68e405726182671f3557b23a4d04940e1734153a23209af5c14 |