Simple python function to convert any kind of image file to PNG

 def convertToPNG(input_webp_file, output_png_file):

    from PIL import Image
    try:
        # Open the WebP image
        with Image.open(input_webp_file) as img:
            # Convert and save as PNG
            img.save(output_png_file, 'PNG')
        print(f"WebP image converted to PNG: {output_png_file}")
    except Exception as e:
        print(f"Error converting WebP to PNG: {e}")

Comments

Popular posts from this blog

Apple iPad Air (2022) Specifications and Review in 2023

17-year-old suspect in fatal stabbing at Taylor Swift-themed dance event ID’d

Exercise vs Diet