Update on BP Structure Template

develop
jhealy 4 years ago
parent 6a78b7d294
commit 0b2e28795a

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Bramble-Hands-Software (BraHaSoft)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Binary file not shown.

@ -1,34 +0,0 @@
# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
# SPDX-License-Identifier: MIT
#!/usr/bin/python3
"""
Be sure to check the learn guides for more usage information.
This example is for use on (Linux) computers that are using CPython with
Adafruit Blinka to support CircuitPython libraries. CircuitPython does
not support PIL/pillow (python imaging library)!
Author(s): Melissa LeBlanc-Williams for Adafruit Industries
"""
import board
import neopixel
from PIL import Image
from adafruit_pixel_framebuf import PixelFramebuffer
pixel_pin = board.D18
pixel_width = 8
pixel_height = 16
pixels = neopixel.NeoPixel(
pixel_pin, pixel_width * pixel_height, brightness=0.1, auto_write=False,
)
pixel_framebuf = PixelFramebuffer(pixels, pixel_width, pixel_height, reverse_x=True,alternating=True)
pixel_framebuf.fill(0x000000)
pixel_framebuf.display()
pixel_framebuf.text("H", 0, 0, 0x00FF00)
pixel_framebuf.display()
pixel_framebuf.text("i", 0, 8, 0x00FF00)
pixel_framebuf.display()

@ -1 +0,0 @@
Jaki is the best.

@ -1,52 +0,0 @@
#Created by Justin Healy
#Based on logic from jsheperd from https://stackoverflow.com/a/27753869/190597
from __future__ import print_function
import string
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import numpy as np
def char_to_pixels(text, path, fontsize):
font = ImageFont.truetype(path, fontsize)
w, h = font.getsize(text)
image = Image.new('L', (w, h), 1)
draw = ImageDraw.Draw(image)
draw.text((0, 0), text, font=font)
arr = np.asarray(image)
arr = np.where(arr, 0, 1)
arr = arr[(arr != 0).any(axis=1)]
return arr
def display(arr):
result = np.where(arr, '1', '0')
print("This gives an Array of Arrays, where reach contained Array is a row")
print(result)
print()
print('\n'.join([''.join(row) for row in result]))
#I have used static coding successfully, now to set this as more reusable declarations rather than hard coding.
#Single Source to change for everything
#Read from file?
fileName = "pilReadTest"
pullFile = open(fileName,"r")
someString = pullFile.read()
#Font Path?
fontPath = "fonts/FreeMonoBold.ttf"
#font Size?
fontSize = 12
#print("This was what was found in the File: "+str(someString))
#print()
#print("Now putting each letter of the found string through the PIL Image Module")
#print()
for c in someString:
arr = char_to_pixels(c,fontPath,fontSize)
print()
#This is the grid size results (w,h)
print(arr.shape)
print()
#print("This is the converted values of the AofAs, for each ROW in Result, the end product")
display(arr)
print()
Loading…
Cancel
Save