-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Blueforcer/awtrix-light
- Loading branch information
Showing
26 changed files
with
341 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-11 | ||
|
||
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none" | ||
|
||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends python3-venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp | ||
{ | ||
"name": "awtrix-light", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
} | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "sudo apt -y update && sudo apt-get -y install python3-venv" | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Converts an image to a RGB888 array | ||
|
||
import argparse | ||
from PIL import Image | ||
|
||
def rgb_to_rgb888(r, g, b): | ||
return (r << 16) | (g << 8) | (b) | ||
|
||
def convert_bmp_to_rgb888_array(file_path): | ||
# Open image | ||
image = Image.open(file_path) | ||
|
||
# Retrieve pixel data | ||
pixels = list(image.convert("RGB").getdata()) | ||
|
||
# Initialize RGB888 array | ||
rgb888_array = [] | ||
|
||
# Iterate through each pixel and convert to RGB888 | ||
for r, g, b in pixels: | ||
rgb888_value = rgb_to_rgb888(r, g, b) | ||
rgb888_array.append(str(rgb888_value)) | ||
|
||
# Join the array elements into a string with square brackets | ||
return "[" + ", ".join(rgb888_array) + "]" | ||
|
||
# Create argument parser | ||
parser = argparse.ArgumentParser(description="Convert an image to an RGB888 array string.") | ||
parser.add_argument("file_path", help="Path to the image to be converted.") | ||
|
||
# Parse arguments | ||
args = parser.parse_args() | ||
|
||
# Convert the BMP file to an RGB888 array string | ||
rgb888_array_string = convert_bmp_to_rgb888_array(args.file_path) | ||
|
||
# Print the converted string | ||
print(rgb888_array_string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.