from PIL import Image import sys def get_png_info(file_path): try: with Image.open(file_path) as img: if img.format != 'PNG': return "This is not a PNG image." info = img.info result = "PNG Information:\n" for key, value in info.items(): result += f"{key}: {value}\n" return result except Exception as e: return f"An error occurred: {str(e)}" if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: python checkpnginfo.py ") else: file_path = sys.argv[1] print(get_png_info(file_path))