{"id":18664651,"url":"https://github.com/scionoftech/webp-converter","last_synced_at":"2025-04-04T17:05:54.578Z","repository":{"id":48981312,"uuid":"42344842","full_name":"scionoftech/webp-converter","owner":"scionoftech","description":"[DEPRECATED] A small node.js library for converting any image to webp file format or converting webp image to any image file format.","archived":false,"fork":false,"pushed_at":"2021-07-04T17:32:37.000Z","size":42386,"stargazers_count":228,"open_issues_count":33,"forks_count":43,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-15T18:26:19.711Z","etag":null,"topics":["cwebp","dwebp","gif2webp","webp-converter","webp-images"],"latest_commit_sha":null,"homepage":"","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":"2015-09-12T04:41:01.000Z","updated_at":"2024-05-04T00:59:15.000Z","dependencies_parsed_at":"2022-08-22T10:10:14.919Z","dependency_job_id":null,"html_url":"https://github.com/scionoftech/webp-converter","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%2Fwebp-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebp-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebp-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scionoftech%2Fwebp-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scionoftech","download_url":"https://codeload.github.com/scionoftech/webp-converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244818784,"owners_count":20515533,"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","webp-converter","webp-images"],"created_at":"2024-11-07T08:24:24.119Z","updated_at":"2025-03-21T15:09:11.225Z","avatar_url":"https://github.com/scionoftech.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"### This repo is no longer supported.\n#### Thanks for all your support!\n\n[![webp-converter Logo](images/nlogo.gif)](https://www.npmjs.com/package/webp-converter)\n\n[webp-converter v2.3.3](https://www.npmjs.com/package/webp-converter)\n\nA small [node.js](http://nodejs.org) library for converting any image to webp file format or converting webp image to any image file format.\n\n\nThis library uses precompiled executables of WebP(v1.1.0) for more info visit [WebP](https://developers.google.com/speed/webp)\n\nFor converting other image formats to webp, please read this documentation  [cwebp Encoder](https://developers.google.com/speed/webp/docs/cwebp)\n\nFor converting webp image to other image format, please read this documentation  [dwebp Encoder](https://developers.google.com/speed/webp/docs/dwebp)\n\nFor converting gif image to webp, please read this documentation [gif2webp Converter](https://developers.google.com/speed/webp/docs/gif2webp)\n\nFor creating animated webp image using webp images, please read this documentation [webpmux Muxer](https://developers.google.com/speed/webp/docs/webpmux)\n\n\n## What's New \n* logging options added\n\n# How to use\n\n## Fix Permission Issue\n\n  ```js\n\nconst webp=require('webp-converter');\n\n// this will grant 755 permission to webp executables\nwebp.grant_permission();\n\n```\n\n# cwebp\n\n## Convert other image format to webp\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.jpeg,.pnp .....) path ,output image(give path where to save and image file name with .webp extension)\n//pass option(read  documentation for options)\n\n//cwebp(input,output,option)\n\nconst result = webp.cwebp(\"nodejs_logo.jpg\",\"nodejs_logo.webp\",\"-q 80\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n## Convert base64 image to webpbase64 image\n\n  ```js\n\nconst webp=require('webp-converter');\n\nfunction get_webpbase64(path) {\n  fs.readFile(path, function (error, data) {\n    if (error) {\n      throw error;\n    } else {\n      let buf = Buffer.from(data);\n      let dataBase64 = Buffer.from(buf).toString('base64');\n        // base64str of image\n      // base64str image type jpg,png ...\n      //option: options and quality,it should be given between 0 to 100\n      let result = webp.str2webpstr(dataBase64,\"jpg\",\"-q 80\");\n      result.then(function(result) {\n        // you access the value from the promise here\n        console.log(result)\n      });\n    }\n  });\n}\n// use the default temp path for conversion\nget_webpbase64(\"./nodejs_logo.jpg\")\n// use the custom temp path for conversion\nget_webpbase64(\"./nodejs_logo.jpg\",\"/home/user/Desktop/webp/temp\")\n\n```\n\n## Convert buffer to webp buffer\n\n  ```js\n\nconst webp=require('webp-converter');\n\nfunction get_webpbuffer(path) {\n  fs.readFile(path, function (error, data) {\n    if (error) {\n      throw error;\n    } else {\n      // buffer of image\n    // buffer image type jpg,png ...\n    //option: options and quality,it should be given between 0 to 100\n      let result = webp.buffer2webpbuffer(data,\"jpg\",\"-q 80\");\n      result.then(function(result) {\n        // you access the value from the promise here\n        console.log(result)\n      });\n    }\n  });\n}\n// use the default temp path for conversion\nget_webpbuffer(\"./nodejs_logo.jpg\")\n// use the custom temp path for conversion\nget_webpbuffer(\"./nodejs_logo.jpg\",\"/home/user/Desktop/webp/temp\")\n\n```\n\n# dwebp\n\n## Convert webp image to other image format\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.webp image) path ,output image(.jpeg,.pnp .....)\n\n//dwebp(input,output,option)\n\nconst result = webp.dwebp(\"nodejs_logo.webp\",\"nodejs_logo.jpg\",\"-o\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n```\n\n# gif2webp\n\n## Convert gif image to webp\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.gif) path ,output image(give path where to save and image file name with .webp extension)\n//pass option(read  documentation for options)\n\n//gwebp(input,output,option)\n\nconst result = webp.gwebp(\"linux_logo.gif\",\"linux_logo.webp\",\"-q 80\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n# webpmux\n\n## Add ICC profile,XMP metadata and EXIF metadata\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.webp image) path ,output image,option profile,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\n\n//webpmux_add(input,output,option_profile,set_option)\n\nconst result = webp.webpmux_add(\"in.webp\",\"icc_container.webp\",\"image_profile.icc\",\"icc\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n## Extract ICC profile,XMP metadata and EXIF metadata\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.webp image) path ,output format(.icc,.xmp and .exif),get 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\n\n//webpmux_extract(input,output,option)\n\nconst result = webp.webpmux_extract(\"anim_container.webp\",\"image_profile.icc\",\"icc\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n## Strip ICC profile,XMP metadata and EXIF metadata\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.webp image) path ,output image(without icc),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\n\n//webpmux_strip(input,output,option)\n\nconst result = webp.webpmux_strip(\"icc_container.webp\",\"without_icc.webp\",\"icc\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n## Create an animated WebP file from Webp images\n\n  ```js\n\n//pass input images(.webp image) path with FRAME_OPTIONS, as array,ouput image will be animated .webp image \n\n\n/*FRAME_OPTIONS\n\n-file_i +di[+xi+yi[+mi[bi]]]\n\ne.g -frame one.webp +100 -frame two.webp +100+50+50 -frame three.webp +100+50+50+1+b \n\nWhere: file_i is the i'th frame (WebP format), xi,yi specify the image offset for this frame, \ndi is the pause duration before next frame, mi is the dispose method for this frame (0 for NONE or 1 for BACKGROUND) and bi is the blending method for this frame (+b for BLEND or -b for NO_BLEND). \nArgument bi can be omitted and will default to +b (BLEND). Also, mi can be omitted if bi is omitted and will default to 0 (NONE). Finally, \nif mi and bi are omitted then xi and yi can be omitted and will default to +0+0.\n\n-loop n\n\ne.g 10\n\nLoop the frames n number of times. 0 indicates the frames should loop forever. Valid range is 0 to 65535 [Default: 0 (infinite)].\n\n-bgcolor A,R,G,B \n\ne.g 255,255,255,255\n\nBackground color of the canvas. Where: A, R, G and B are integers in the range 0 to 255 specifying the Alpha, Red, Green and Blue component values respectively [Default: 255,255,255,255].\n*/\n\n//webpmux_animate(input_images_array,output,bgcolor)\n\nconst webp=require('webp-converter');\n\nlet input=[{\"path\":\"./frames/tmp-0.webp\",\"offset\":\"+100\"},{\"path\":\"./frames/tmp-1.webp\", \"offset\":\"+100\"},{\"path\":\"./frames/tmp-2.webp\",\"offset\":\"+100\"}];\nconst result = webp.webpmux_animate(input,\"anim_container.webp\",\"10\",\"255,255,255,255\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n## Get a frame from an animated WebP file\n\n  ```js\n\nconst webp=require('webp-converter');\n\n//pass input image(.webp image) path ,output image and frame number\n\n//webpmux_getframe(input,ouput,frame number)\n\nconst result = webp.webpmux_getframe(\"anim_container.webp\",\"frame_2.webp\",\"2\",logging=\"-v\");\nresult.then((response) =\u003e {\n\tconsole.log(response);\n  });\n\n\n```\n\n## Installation\n\n```bash\n$ npm install webp-converter\n```\n\n## License\n\n  [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscionoftech%2Fwebp-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscionoftech%2Fwebp-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscionoftech%2Fwebp-converter/lists"}