hamstern

Monochromer

Oct 26th, 2025
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import sys
  2. from PIL import Image
  3.  
  4. def convert_to_grayscale_bmp(input_path, output_path):
  5.     img = Image.open(input_path)
  6.     grayscale_img = img.convert('L')
  7.     grayscale_img.save(output_path, 'BMP')
  8.  
  9. input_file = sys.argv[1]
  10. output_file = input_file.strip(".jpg") + ".bmp"
  11.  
  12. convert_to_grayscale_bmp(input_file, output_file)
Advertisement
Add Comment
Please, Sign In to add comment