Skip to content

Instantly share code, notes, and snippets.

@mikedigriz
Created February 2, 2024 18:58
Show Gist options
  • Select an option

  • Save mikedigriz/6830eaaedcbba99afbe216c3d9195c06 to your computer and use it in GitHub Desktop.

Select an option

Save mikedigriz/6830eaaedcbba99afbe216c3d9195c06 to your computer and use it in GitHub Desktop.

Revisions

  1. mikedigriz created this gist Feb 2, 2024.
    20 changes: 20 additions & 0 deletions 8bit.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    ## 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)