Skip to content

SajixInc/png2webp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

png2webp Using Python

PNG to WebP conversion refers to the process of converting images from the Portable Network Graphics (PNG) format to the WebP format.

PNG is a lossless image format widely used for storing and displaying images on the web. It supports transparency and produces high-quality images. However, PNG files can be relatively large in size, which can impact website loading times.

WebP, on the other hand, is a modern image format developed by Google. It utilizes both lossy and lossless compression techniques to achieve smaller file sizes without significant loss of image quality. WebP images can result in faster page loading speeds and reduced bandwidth usage.

Converting PNG images to WebP format can be beneficial for web development and optimization. It allows you to reduce the file size of images while maintaining acceptable image quality, resulting in improved web performance and faster loading times for websites.

WebP Converter

  • This is a Python script that converts WebP images to PNG format.

Requirements

  • Python 3.x
  • PIL (Python Imaging Library)

Installation

  1. Clone the repository:

    git clone https://github.com/vivifyhealthcare/png2webp.git

  2. Install the required dependencies:

    pip install pillow

    pip install webp

Usage

  1. Place your WebP images in the input directory.

  2. Uncomment the function as per user requirement

    • if you want convert a single file --> image_converstion()
    • or you want to convert bulk files --> bluk_converstion()
  3. The converted PNG images will be saved in the output directory.

Customization

  • You can change the input and output directories by modifying the input_dir and output_dir variables in convert.py.

  • To convert to a different image format (e.g., JPEG), modify the convert function in convert.py accordingly.

License

  • This project is licensed under the MIT License.

Contributing

  • Contributions are welcome! If you find any issues or have suggestions, please open an issue or submit a pull request.

Acknowledgments

  • This script is based on the examples provided in the Python Imaging Library (PIL) documentation.

Disclaimer

  • This script is provided as-is without any warranty. Use it at your own risk.

    Feel free to customize and enhance this README file based on your specific project requirements and guidelines.