Skip to content

Instantly share code, notes, and snippets.

@mikedigriz
Created February 2, 2024 18:58
Show Gist options
  • Save mikedigriz/6830eaaedcbba99afbe216c3d9195c06 to your computer and use it in GitHub Desktop.
Save mikedigriz/6830eaaedcbba99afbe216c3d9195c06 to your computer and use it in GitHub Desktop.
convert img to 8bit bmp
## Installation:
# python3 -m venv env
# . env/bin/activate
# pip install --upgrade pip
# pip install opencv-python
## Launch:
# python3 8bit.py
import cv2
# Load your image
image = cv2.imread('input.png')
# Convert the image to 8-bit color depth
image_8bit = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Save the 8-bit image
cv2.imwrite('syncthing_app.bmp', image_8bit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment