Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem converting image. #5

Open
WanderLG opened this issue Sep 19, 2019 · 0 comments
Open

Problem converting image. #5

WanderLG opened this issue Sep 19, 2019 · 0 comments

Comments

@WanderLG
Copy link

Hello, how are you?

By converting your font.gif with converter.py I am not getting the same result as you did. Look:

const int bmap [8] = {
B0, B0, B1, B1, B1, B0, B0, B0, B0, B1, B0, B0, B0, B1, B0, B0, B1, B0, B0, B0, B1, B0, B1, B0, B1, B0, B0, B1, B0, B0, B1, B0, B1, B0, B1, B0, B0, B0, B1, B0, B0, B1, B0, B0, B0, B1, B0, B0, B0, B0, B1, B1, B1, B0, B0, B0, B0,
B0,
B0,
B0,
B0,
B0,
B0,
B0,
B0, B0, B0, B0, B0, B0, B0, B0, B0, B0, B1, B0, B0, B0, B0, B1, B0, B0, B0, B0, B0, B0, B1, B0, B1, B1, B1, B1, B1, B1, B1, B0, B0, B0, B0, B0, B0, B0, B0, B1, B0, B0, B0, B0, B0, B0, B1, B0, B0, B0, B0, B0, B0, B0, B0, B0, B0,
...
...
...
}

But I don't understand anything about python and I don't know how to fix the problem. Can you help me?
I am using your script.


import sys
import numpy
from PIL import Image

im = Image.open(sys.argv[1])
im = im.convert("1")
rows = (im.size[1] // 8)
cols = im.size[0]
val = ""

print("const int bmap[8]= {")

for p in range(rows):
for xx in range(cols):
for yy in range(8):
pix = im.getpixel((xx,(p * 8) + yy))
if (pix == 0):
val = "1" + val
else:
val = "0" + val
val = "B" + val
print(val + ",", end='')
val = ""
if (xx % 8 == 7):
print("")

print("}")

Thanks. and congratulations. You have greatly reduced the use of atmega328p with your library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant