1
- [ Webptools v0.0.3 ] ( https://pypi.org/project/webptools/ )
1
+ [ Webptools v0.0.4 ] ( https://pypi.org/project/webptools/ )
2
2
3
- webptools is a Webp image conversion package for python.
3
+ webptools is a Webp image conversion package for the python.
4
4
5
5
Convert JPG,PNG.. images to webp image format
6
6
7
- This library uses precompiled executables of WebP for more info visit [ WebP] ( https://developers.google.com/speed/webp )
7
+ This library uses precompiled executables of WebP(v1.1.0) for more info
8
+ visit [ WebP] ( https://developers.google.com/speed/webp )
8
9
9
- For converting other image formats to webp, please read this documentation [ cwebp Encoder] ( https://developers.google.com/speed/webp/docs/cwebp )
10
+ For converting other image formats to webp, please read this
11
+ documentation [ cwebp Encoder] ( https://developers.google.com/speed/webp/docs/cwebp )
10
12
11
- For converting webp image to other image format, please read this documentation [ dwebp Encoder] ( https://developers.google.com/speed/webp/docs/dwebp )
13
+ For converting webp image to other image format, please read this
14
+ documentation [ dwebp Encoder] ( https://developers.google.com/speed/webp/docs/dwebp )
12
15
13
- For converting gif image to webp, please read this documentation [ gif2webp Converter] ( https://developers.google.com/speed/webp/docs/gif2webp )
16
+ For converting gif image to webp, please read this
17
+ documentation [ gif2webp Converter] ( https://developers.google.com/speed/webp/docs/gif2webp )
14
18
15
- For creating animated webp image using webp images, please read this documentation [ webpmux Muxer] ( https://developers.google.com/speed/webp/docs/webpmux )
19
+ For creating animated webp image using webp images, please read this
20
+ documentation [ webpmux Muxer] ( https://developers.google.com/speed/webp/docs/webpmux )
16
21
22
+ ## What's New
17
23
18
- ## What's New
19
- * Precompiled executables of WebP(v1.1.0) added
20
-
24
+ * webp executables permission issue fixed
25
+ * base64 to webp base64 added
26
+ * logging options added
21
27
22
28
# How to use
23
29
30
+ ## Fix Permission Issue
31
+
32
+ ``` python
33
+
34
+ from webptools import grant_permission
35
+
36
+ # this will grant 755 permission to webp executables
37
+ grant_permission()
38
+
39
+ ```
40
+
24
41
# cwebp
25
42
26
43
## Convert other image format to webp
@@ -31,8 +48,29 @@ from webptools import cwebp
31
48
32
49
# pass input_image(.jpeg,.pnp .....) path ,
33
50
# output_image(give path where to save and image file name with .webp file type extension)
34
- print (cwebp(" python_logo.jpg" , " python_logo.webp" , " -q 80" ))
51
+ print (cwebp(input_image = " python_logo.jpg" , output_image = " python_logo.webp" ,
52
+ option = " -q 80" , logging = " -v" ))
53
+
54
+
55
+ ```
56
+
57
+ ## Convert base64 image to webp base64
58
+
59
+ ``` python
60
+
61
+ from webptools import base64str2webp_base64str
62
+
63
+ # pass base64 image, image type, webp options,
64
+ # for the conversion temp location need
35
65
66
+ # use the default temp path for conversion
67
+ print (
68
+ base64str2webp_base64str(base64str = " " , image_type = " jpg" , option = " -q 80" ,
69
+ logging = " -v" ))
70
+ # use the custom temp path for conversion
71
+ print (base64str2webp_base64str(base64str = " " , image_type = " jpg" , option = " -q 80" ,
72
+ temp_path = " ./temp" ,
73
+ logging = " -v" ))
36
74
37
75
```
38
76
@@ -45,7 +83,8 @@ print(cwebp("python_logo.jpg", "python_logo.webp", "-q 80"))
45
83
from webptools import dwebp
46
84
47
85
# pass input_image(.webp image) path ,output_image(.jpeg,.pnp .....)
48
- print (dwebp(" python_logo.webp" ," python_logo.jpg" ," -o" ))
86
+ print (dwebp(input_image = " python_logo.webp" , output_image = " python_logo.jpg" ,
87
+ option = " -o" , logging = " -v" ))
49
88
50
89
```
51
90
@@ -57,7 +96,8 @@ print(dwebp("python_logo.webp","python_logo.jpg","-o"))
57
96
from webptools import gifwebp
58
97
59
98
# pass input_image(.gif) path ,output_image(give path where to save and image file name with .webp file type extension)
60
- print (gifwebp(" linux_logo.gif" ," linux_logo.webp" ," -q 80" ))
99
+ print (gifwebp(input_image = " linux_logo.gif" , output_image = " linux_logo.webp" ,
100
+ option = " -q 80" , logging = " -v" ))
61
101
```
62
102
63
103
# webpmux
@@ -72,7 +112,8 @@ from webptools import webpmux_add
72
112
# for ICC: icc
73
113
# for XMP metadata: xmp
74
114
# for EXIF metadata: exif
75
- print (webpmux_add(" in.webp" ," icc_container.webp" ," image_profile.icc" ," icc" ))
115
+ print (webpmux_add(input_image = " in.webp" , output_image = " icc_container.webp" ,
116
+ icc_profile = " image_profile.icc" , option = " icc" , logging = " -v" ))
76
117
```
77
118
78
119
## Extract ICC profile,XMP metadata and EXIF metadata
@@ -86,7 +127,9 @@ from webptools import webpmux_extract
86
127
# for ICC: icc
87
128
# for XMP metadata: xmp
88
129
# for EXIF metadata: exif
89
- print (webpmux_extract(" anim_container.webp" ," image_profile.icc" ," icc" ))
130
+ print (webpmux_extract(input_image = " anim_container.webp" ,
131
+ icc_profile = " image_profile.icc" , option = " icc" ,
132
+ logging = " -v" ))
90
133
```
91
134
92
135
## Strip ICC profile,XMP metadata and EXIF metadata
@@ -100,7 +143,9 @@ from webptools import webpmux_strip
100
143
# for ICC: icc
101
144
# for XMP metadata: xmp
102
145
# for EXIF metadata: exif
103
- print (webpmux_strip(" icc_container.webp" ," without_icc.webp" ," icc" ))
146
+ print (webpmux_strip(input_image = " icc_container.webp" ,
147
+ output_image = " without_icc.webp" , option = " icc" ,
148
+ logging = " -v" ))
104
149
105
150
106
151
```
@@ -141,8 +186,10 @@ from webptools import webpmux_animate
141
186
# Background color of the canvas. Where: A, R, G and B are integers in the range 0 to 255 specifying
142
187
# the Alpha, Red, Green and Blue component values respectively [Default: 255,255,255,255].
143
188
144
- input = [" ./frames/tmp-0.webp +100" ," ./frames/tmp-1.webp +100" ," ./frames/tmp-2.webp +100" ]
145
- print (webpmux_animate(input ," anim_container.webp" ," 10" ," 255,255,255,255" ))
189
+ input = [" ./frames/tmp-0.webp +100" , " ./frames/tmp-1.webp +100" ,
190
+ " ./frames/tmp-2.webp +100" ]
191
+ print (webpmux_animate(input_images = input , output_image = " anim_container.webp" ,
192
+ loop = " 10" , bgcolor = " 255,255,255,255" , logging = " -v" ))
146
193
147
194
```
148
195
@@ -153,7 +200,9 @@ print(webpmux_animate(input,"anim_container.webp","10","255,255,255,255"))
153
200
from webptools import webpmux_getframe
154
201
155
202
# pass input_image(.webp image) path ,output_image and frame number
156
- print (webpmux_getframe(" anim_container.webp" ," frame_2.webp" ," 2" ))
203
+ print (webpmux_getframe(input_image = " anim_container.webp" ,
204
+ output_image = " frame_2.webp" , frame_number = " 2" ,
205
+ logging = " -v" ))
157
206
158
207
159
208
```
@@ -166,4 +215,4 @@ $ pip install webptools
166
215
167
216
## License
168
217
169
- [ MIT] ( LICENSE )
218
+ [ MIT] ( LICENSE )
0 commit comments