wellcome to my blog. in this blog i am going to tell about image to webp converter. i already create GUI tool for this , i already explain about hhow this tool help full for content writers.
Tool Cli version
in this project , i make it ths tool in cli interface why because, i always use linux i can make my process quickly thats why i created this cli tool for it.
so i decited to write python code then i will change it to executable format then i move it into /usr/bin/
after i can use that tool like this
webp -i /location/path/image.jpg -o output.webp
Step by step instruction tocreating this tool
just write the code for cli tool
#!/usr/bin/env python3
from PIL import Image
import os
import argparse
def convert_image_to_webp(input_image_path, output_image_path):
with Image.open(input_image_path) as img:
img.save(output_image_path, 'WEBP')
print(f"Saved WebP image to: {output_image_path}")
def main():
parser = argparse.ArgumentParser(description="Convert images to WebP format.")
parser.add_argument('-i', '--input', required=True, help="Input image path")
parser.add_argument('-o', '--output', required=True, help="Output image path (e.g., output.webp)")
args = parser.parse_args()
convert_image_to_webp(args.input, args.output)
if __name__ == '__main__':
main()
i save that like webp.py
then rename it like webp then give execute permissions
mv webp.py webp
chmod +x webp
Move it to /usr/bin/
sudo mv webp /usr/bin/webp
thats it , then we can use that tool in command line interface like this
webp -i /path/to/image.jpg -o output.webp
Install Required Dependencies
make sure python library pillow installed or NOT
pip install pillow
we can use this command for install pillow library in linux , we need to create virtual envirement for installing this library
but i use pacman package why because i dont need virtual envirement i can execute any places thats why i use pacman pakages
sudo pacman -S python-pillow
thats it , thank you for reading my blog , i will see you in the next blog
-
Lo-Fi TryHackMe Writeup
wellcome to lo-fi tryhackme challange , i just simple writeup for it , without to much explanations first of all […]
-
Tryhackme W1seGuy walkthrough
welcome to my blog i am aathil ducky in this blog post i am going to write blog post for […]
-
How to Install and Use LocalSend on Arch Linux and Mobile
Introduction Ever tried emailing a file to yourself just to move it between devices? Yeah, me too. I’m Aathil Ducky, […]
-
I created CLI tool for convert image Webp format
wellcome to my blog. in this blog i am going to tell about image to webp converter. i already create […]
-
How to install Brave Browser on arch linux
wellcome to my blogpost after log time i write blog post , its just simple blog post for how to […]