{"id":18664630,"url":"https://github.com/scionoftech/webptools","last_synced_at":"2025-04-11T21:33:00.798Z","repository":{"id":45033874,"uuid":"165281150","full_name":"scionoftech/webptools","owner":"scionoftech","description":"webptools is a Webp image conversion package for python","archived":false,"fork":false,"pushed_at":"2022-01-13T07:40:25.000Z","size":35984,"stargazers_count":23,"open_issues_count":12,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T19:21:24.288Z","etag":null,"topics":["cwebp","dwebp","gif2webp","image-processing","python","webp-images"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scionoftech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-11T17:16:25.000Z","updated_at":"2024-08-09T15:06:03.000Z","dependencies_parsed_at":"2022-08-27T16:30:59.482Z","dependency_job_id":null,"html_url":"https://github.com/scionoftech/webptools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebptools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebptools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebptools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebptools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scionoftech","download_url":"https://codeload.github.com/scionoftech/webptools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248483384,"owners_count":21111438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cwebp","dwebp","gif2webp","image-processing","python","webp-images"],"created_at":"2024-11-07T08:24:20.667Z","updated_at":"2025-04-11T21:32:55.775Z","avatar_url":"https://github.com/scionoftech.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Webptools v0.0.9](https://pypi.org/project/webptools/)\n\nwebptools is a Webp image conversion package for the python.\n\nConvert JPG,PNG.. images to webp image format\n\nThis library uses precompiled executables of WebP(v1.1.0) for more info\nvisit [WebP](https://developers.google.com/speed/webp)\n\nFor converting other image formats to webp, please read this\ndocumentation  [cwebp Encoder](https://developers.google.com/speed/webp/docs/cwebp)\n\nFor converting webp image to other image format, please read this\ndocumentation  [dwebp Encoder](https://developers.google.com/speed/webp/docs/dwebp)\n\nFor converting gif image to webp, please read this\ndocumentation [gif2webp Converter](https://developers.google.com/speed/webp/docs/gif2webp)\n\nFor creating animated webp image using webp images, please read this\ndocumentation [webpmux Muxer](https://developers.google.com/speed/webp/docs/webpmux)\n\n\n# How to use\n\n## Installation\n\n```shell\n$ pip install webptools\n```\n\n## Fix Permission Issue (if not using external executables)\n\n```python\n\nfrom webptools import grant_permission\n\n# this will grant 755 permission to webp executables\ngrant_permission()\n\n```\n\n### Using External executables\n\n```python\n\nbin_path=\"libwebp_linux/bin/cwebp\"\n\n```\n\n# cwebp\n\n## Convert other image format to webp\n\n```python\n\nfrom webptools import cwebp\n\n# pass input_image(.jpeg,.pnp .....) path ,\n# output_image(give path where to save and image file name with .webp file type extension)\nprint(cwebp(input_image=\"python_logo.jpg\", output_image=\"python_logo.webp\",\n            option=\"-q 80\", logging=\"-v\"))\n\n\n```\n\n## Convert base64 image to webp base64\n\n```python\n\nfrom webptools import base64str2webp_base64str\n\n# pass base64 image, image type, webp options,\n# for the conversion temp location need \n\n# use the default temp path for conversion\nprint(\n    base64str2webp_base64str(base64str=\"\", image_type=\"jpg\", option=\"-q 80\",\n                             logging=\"-v\"))\n# use the custom temp path for conversion\nprint(base64str2webp_base64str(base64str=\"\", image_type=\"jpg\", option=\"-q 80\",\n                               temp_path=\"./temp\",\n                               logging=\"-v\"))\n\n```\n\n# dwebp\n\n## Convert webp image to other image format\n\n```python\n\nfrom webptools import dwebp\n\n# pass input_image(.webp image) path ,output_image(.jpeg,.pnp .....)\nprint(dwebp(input_image=\"python_logo.webp\", output_image=\"python_logo.jpg\",\n            option=\"-o\", logging=\"-v\"))\n\n```\n\n# gif2webp\n\n## Convert gif image to webp\n\n```python\nfrom webptools import gifwebp\n\n# pass input_image(.gif) path ,output_image(give path where to save and image file name with .webp file type extension)\nprint(gifwebp(input_image=\"linux_logo.gif\", output_image=\"linux_logo.webp\",\n              option=\"-q 80\", logging=\"-v\"))\n```\n\n# webpmux\n\n## Add ICC profile,XMP metadata and EXIF metadata\n\n```python\nfrom webptools import webpmux_add\n\n# pass input_image(.webp image) path,output_image,set options(icc image profile,XMP metadata or EXIF metadata) and file.\n# for options use keywords as below\n# for ICC: icc\n# for XMP metadata: xmp\n# for EXIF metadata: exif\nprint(webpmux_add(input_image=\"in.webp\", output_image=\"icc_container.webp\",\n                  icc_profile=\"image_profile.icc\", option=\"icc\"))\n```\n\n## Extract ICC profile,XMP metadata and EXIF metadata\n\n```python\n\nfrom webptools import webpmux_extract\n\n# pass input_image(.webp image) path,output_image,set options(icc image profile,XMP metadata or EXIF metadata) and file.\n# for options use keywords as below\n# for ICC: icc\n# for XMP metadata: xmp\n# for EXIF metadata: exif\nprint(webpmux_extract(input_image=\"anim_container.webp\",\n                      icc_profile=\"image_profile.icc\", option=\"icc\"))\n```\n\n## Strip ICC profile,XMP metadata and EXIF metadata\n\n```python\n\nfrom webptools import webpmux_strip\n\n# pass input_image(.webp image) path,output_image,set options(icc image profile,XMP metadata or EXIF metadata) and file.\n# for options use keywords as below\n# for ICC: icc\n# for XMP metadata: xmp\n# for EXIF metadata: exif\nprint(webpmux_strip(input_image=\"icc_container.webp\",\n                    output_image=\"without_icc.webp\", option=\"icc\"))\n\n\n```\n\n## Create an animated WebP file from Webp images\n\n```python\n\nfrom webptools import webpmux_animate\n\n# pass input_images(.webp image) path with FRAME_OPTIONS, as array,ouput image will be animated .webp image\n\n# https://developers.google.com/speed/webp/docs/webpmux\n# FRAME_OPTIONS\n\n# -file_i +di[+xi+yi[+mi[bi]]]\n\n# e.g -frame one.webp +100 -frame two.webp +100+50+50 -frame three.webp +100+50+50+1+b\n\n# Where: file_i is the i'th frame (WebP format), xi,yi specify the image offset for this frame,\n# di is the pause duration before next frame, mi is the dispose method for this frame (0 for NONE or 1 for BACKGROUND)\n# and bi is the blending method for this frame (+b for BLEND or -b for NO_BLEND).\n# Argument bi can be omitted and will default to +b (BLEND). Also, mi can be omitted if bi is omitted and\n# will default to 0 (NONE). Finally,\n# if mi and bi are omitted then xi and yi can be omitted and will default to +0+0.\n\n# -loop n\n\n# e.g 10\n\n# Loop the frames n number of times. 0 indicates the frames should loop forever.\n# Valid range is 0 to 65535 [Default: 0 (infinite)].\n\n# -bgcolor A,R,G,B\n\n# e.g 255,255,255,255\n\n# Background color of the canvas. Where: A, R, G and B are integers in the range 0 to 255 specifying\n# the Alpha, Red, Green and Blue component values respectively [Default: 255,255,255,255].\n\ninput = [\"./frames/tmp-0.webp +100\", \"./frames/tmp-1.webp +100\",\n         \"./frames/tmp-2.webp +100\"]\nprint(webpmux_animate(input_images=input, output_image=\"anim_container.webp\",\n                      loop=\"10\", bgcolor=\"255,255,255,255\"))\n\n```\n\n## Get a frame from an animated WebP file\n\n```python\n\nfrom webptools import webpmux_getframe\n\n# pass input_image(.webp image) path ,output_image and frame number\nprint(webpmux_getframe(input_image=\"anim_container.webp\",\n                       output_image=\"frame_2.webp\", frame_number=\"2\"))\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscionoftech%2Fwebptools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscionoftech%2Fwebptools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscionoftech%2Fwebptools/lists"}