Skip to content

Commit 4512b7a

Browse files
Sai Kumar YavaSai Kumar Yava
Sai Kumar Yava
authored and
Sai Kumar Yava
committed
first commit
1 parent 0d14bc8 commit 4512b7a

File tree

188 files changed

+19635
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+19635
-0
lines changed

MANIFEST.in

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
include README.md
2+
include README_SMALL.md
3+
include LICENSE
4+
include webptools/*.py
5+
6+
include lib/libwebp_linux/bin/anim_diff
7+
include lib/libwebp_linux/bin/anim_dump
8+
include lib/libwebp_linux/bin/cwebp
9+
include lib/libwebp_linux/bin/dwebp
10+
include lib/libwebp_linux/bin/get_disto
11+
include lib/libwebp_linux/bin/gif2webp
12+
include lib/libwebp_linux/bin/img2webp
13+
include lib/libwebp_linux/bin/vwebp
14+
include lib/libwebp_linux/bin/webp_quality
15+
include lib/libwebp_linux/bin/webpinfo
16+
include lib/libwebp_linux/bin/webpmux
17+
18+
include lib/libwebp_linux/doc/*.html
19+
include lib/libwebp_linux/doc/*.txt
20+
include lib/libwebp_linux/include/webp/*.h
21+
include lib/libwebp_linux/lib/*.a
22+
23+
24+
include lib/libwebp_osx/bin/anim_diff
25+
include lib/libwebp_osx/bin/anim_dump
26+
include lib/libwebp_osx/bin/cwebp
27+
include lib/libwebp_osx/bin/dwebp
28+
include lib/libwebp_osx/bin/get_disto
29+
include lib/libwebp_osx/bin/gif2webp
30+
include lib/libwebp_osx/bin/img2webp
31+
include lib/libwebp_osx/bin/vwebp
32+
include lib/libwebp_osx/bin/webp_quality
33+
include lib/libwebp_osx/bin/webpinfo
34+
include lib/libwebp_osx/bin/webpmux
35+
36+
include lib/libwebp_osx/doc/*.html
37+
include lib/libwebp_osx/doc/*.txt
38+
include lib/libwebp_osx/include/webp/*.h
39+
include lib/libwebp_osx/lib/*.a
40+
41+
42+
include lib/libwebp_win32/bin/anim_diff.exe
43+
include lib/libwebp_win32/bin/anim_dump.exe
44+
include lib/libwebp_win32/bin/cwebp.exe
45+
include lib/libwebp_win32/bin/dwebp.exe
46+
include lib/libwebp_win32/bin/freeglut.dll
47+
include lib/libwebp_win32/bin/get_disto.exe
48+
include lib/libwebp_win32/bin/gif2webp.exe
49+
include lib/libwebp_win32/bin/img2webp.exe
50+
include lib/libwebp_win32/bin/vwebp.exe
51+
include lib/libwebp_win32/bin/webp_quality.exe
52+
include lib/libwebp_win32/bin/webpinfo.exe
53+
include lib/libwebp_win32/bin/webpmux.exe
54+
55+
include lib/libwebp_win32/include/webp/*.h
56+
include lib/libwebp_win32/lib/*.lib
57+
58+
include lib/libwebp_win64/bin/anim_diff.exe
59+
include lib/libwebp_win64/bin/anim_dump.exe
60+
include lib/libwebp_win64/bin/cwebp.exe
61+
include lib/libwebp_win64/bin/dwebp.exe
62+
include lib/libwebp_win32/bin/freeglut.dll
63+
include lib/libwebp_win64/bin/get_disto.exe
64+
include lib/libwebp_win64/bin/gif2webp.exe
65+
include lib/libwebp_win64/bin/img2webp.exe
66+
include lib/libwebp_win64/bin/vwebp.exe
67+
include lib/libwebp_win64/bin/webp_quality.exe
68+
include lib/libwebp_win64/bin/webpinfo.exe
69+
include lib/libwebp_win64/bin/webpmux.exe
70+
71+
include lib/libwebp_win64/include/webp/*.h
72+
include lib/libwebp_win64/lib/*.lib

PKG-INFO

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
Metadata-Version: 1.0
2+
Name: webptools
3+
Version: 0.0.1
4+
Summary: Webp image conversion package for python.
5+
Home-page: https://github.com/scionoftech/webptools
6+
Author: Sai Kumar Yava
7+
Author-email: [email protected]
8+
License: MIT
9+
Description: webptools is a Webp image conversion package for python.
10+
====================
11+
12+
13+
Installation
14+
------------
15+
16+
.. code:: sh
17+
18+
from webptools import webplib as webp
19+
20+
21+
- This library uses precompiled executables of WebP for more info visit `WebP <https://developers.google.com/speed/webp>`
22+
- For converting other image formats to webp, please read this documentation `cwebp Encoder <https://developers.google.com/speed/webp/docs/cwebp>`
23+
- For converting webp image to other image format, please read this documentation `dwebp Encoder <https://developers.google.com/speed/webp/docs/dwebp>`
24+
- For converting gif image to webp, please read this documentation `gif2webp Converter <https://developers.google.com/speed/webp/docs/gif2webp>`
25+
- For creating animated webp image using webp images, please read this documentation `webpmux Muxer <https://developers.google.com/speed/webp/docs/webpmux>`
26+
27+
Usage
28+
-----
29+
30+
.. code:: python
31+
32+
import webptools
33+
34+
How to use
35+
~~~~~~~~~~
36+
cwebp
37+
~~~~~~~~~~
38+
Convert other image format to webp
39+
~~~~~~~~~~
40+
41+
.. code:: python
42+
43+
from webptools import webplib as webp
44+
45+
# pass input_image(.jpeg,.pnp .....) path ,
46+
# output_image(give path where to save and image file name with .webp file type extension)
47+
print(webp.cwebp("python_logo.jpg", "python_logo.webp", "-q 80"))
48+
49+
50+
51+
dwebp
52+
~~~~~~~~~~
53+
Convert webp image to other image format
54+
~~~~~~~~~~
55+
56+
.. code:: python
57+
58+
from webptools import webplib as webp
59+
60+
# pass input_image(.webp image) path ,output_image(.jpeg,.pnp .....)
61+
print(webp.dwebp("python_logo.webp","python_logo.jpg","-o"))
62+
63+
64+
gif2webp
65+
~~~~~~~~~~
66+
Convert gif image to webp
67+
~~~~~~~~~~
68+
69+
.. code:: python
70+
71+
from webptools import webplib as webp
72+
73+
# pass input_image(.gif) path ,output_image(give path where to save and image file name with .webp file type extension)
74+
print(webp.gifwebp("linux_logo.gif","linux_logo.webp","-q 80"))
75+
76+
77+
webpmux
78+
~~~~~~~~~~
79+
Add ICC profile,XMP metadata and EXIF metadata
80+
~~~~~~~~~~
81+
82+
.. code:: python
83+
84+
from webptools import webplib as webp
85+
86+
# pass input_image(.webp image) path,output_image,set options(icc image profile,XMP metadata or EXIF metadata) and file.
87+
# for options use keywords as below
88+
# for ICC: icc
89+
# for XMP metadata: xmp
90+
# for EXIF metadata: exif
91+
print(webp.webpmux_add("in.webp","icc_container.webp","image_profile.icc","icc"))
92+
93+
94+
95+
Extract ICC profile,XMP metadata and EXIF metadata
96+
~~~~~~~~~~
97+
98+
.. code:: python
99+
100+
from webptools import webplib as webp
101+
102+
# pass input_image(.webp image) path,output_image,set options(icc image profile,XMP metadata or EXIF metadata) and file.
103+
# for options use keywords as below
104+
# for ICC: icc
105+
# for XMP metadata: xmp
106+
# for EXIF metadata: exif
107+
print(webp.webpmux_extract("anim_container.webp","image_profile.icc","icc"))
108+
109+
110+
Strip ICC profile,XMP metadata and EXIF metadata
111+
~~~~~~~~~~
112+
113+
.. code:: python
114+
115+
from webptools import webplib as webp
116+
117+
# pass input_image(.webp image) path,output_image,set options(icc image profile,XMP metadata or EXIF metadata) and file.
118+
# for options use keywords as below
119+
# for ICC: icc
120+
# for XMP metadata: xmp
121+
# for EXIF metadata: exif
122+
print(webp.webpmux_strip("icc_container.webp","without_icc.webp","icc"))
123+
124+
125+
126+
Create an animated WebP file from Webp images
127+
~~~~~~~~~~
128+
129+
.. code:: python
130+
131+
from webptools import webplib as webp
132+
133+
# pass input_images(.webp image) path with FRAME_OPTIONS, as array,ouput image will be animated .webp image
134+
135+
# https://developers.google.com/speed/webp/docs/webpmux
136+
# FRAME_OPTIONS
137+
138+
# -file_i +di[+xi+yi[+mi[bi]]]
139+
140+
# e.g -frame one.webp +100 -frame two.webp +100+50+50 -frame three.webp +100+50+50+1+b
141+
142+
# Where: file_i is the i'th frame (WebP format), xi,yi specify the image offset for this frame,
143+
# di is the pause duration before next frame, mi is the dispose method for this frame (0 for NONE or 1 for BACKGROUND)
144+
# and bi is the blending method for this frame (+b for BLEND or -b for NO_BLEND).
145+
# Argument bi can be omitted and will default to +b (BLEND). Also, mi can be omitted if bi is omitted and
146+
# will default to 0 (NONE). Finally,
147+
# if mi and bi are omitted then xi and yi can be omitted and will default to +0+0.
148+
149+
# -loop n
150+
151+
# e.g 10
152+
153+
# Loop the frames n number of times. 0 indicates the frames should loop forever.
154+
# Valid range is 0 to 65535 [Default: 0 (infinite)].
155+
156+
# -bgcolor A,R,G,B
157+
158+
# e.g 255,255,255,255
159+
160+
# Background color of the canvas. Where: A, R, G and B are integers in the range 0 to 255 specifying
161+
# the Alpha, Red, Green and Blue component values respectively [Default: 255,255,255,255].
162+
163+
input=["./frames/tmp-0.webp +100","./frames/tmp-1.webp +100","./frames/tmp-2.webp +100"]
164+
print(webp.webpmux_animate(input,"anim_container.webp","10","255,255,255,255"))
165+
166+
167+
168+
Get a frame from an animated WebP file
169+
~~~~~~~~~~
170+
171+
.. code:: python
172+
173+
from webptools import webplib as webp
174+
175+
# pass input_image(.webp image) path ,output_image and frame number
176+
print(webp.webpmux_getframe("anim_container.webp","frame_2.webp","2"))
177+

0 commit comments

Comments
 (0)