Page 1 of 1

.BMP image issues.

Posted: Sun May 12, 2019 6:54 pm
by AJB2K3
I'm struggling to get an image to show on the screen of an m5Stack.
I have managed to reduce the file to 6Kb and it is supposed to be on the devices internal storage but it doesn't show on screen.

This is my code.

Code: Select all

from m5stack import *
from m5ui import *

clear_bg(0x222222)



btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
image1 = M5Img(1, 1, "res/Gbkg.bmp", True)
rectangle5 = M5Rect(58, 150, 30, 30, 0xFFFFFF, 0xFFFFFF)

pos = None



image1.changeImg("res/default.jpg")
pos = 0
while True:
  image1.show()
  image1.setPosition(x=pos)
  pos = pos + 1
  wait(1)
  wait(0.001)
Has anyone been successful with images on the M5Stack?

Re: .BMP image issues.

Posted: Tue May 14, 2019 2:26 am
by jimmo
So M5 is a fork of a fork of MicroPython, so this might not be the ideal place to find help. Maybe try http://community.m5stack.com/

But some ideas to try:
- Can you try this with a simpler example? Maybe try doing this entirely on the REPL:
- Use os.listdir to confirm that the file definitely exists.
- Once you've opened the image (make sure no exceptions are raised) have a look at the pixel data to see if it's what you expect.
- Does it work for other BMP files? Does the JPG in your example code work?

Re: .BMP image issues.

Posted: Tue May 14, 2019 5:50 am
by AJB2K3
jimmo wrote:
Tue May 14, 2019 2:26 am
So M5 is a fork of a fork of MicroPython, so this might not be the ideal place to find help. Maybe try http://community.m5stack.com/

But some ideas to try:
- Can you try this with a simpler example? Maybe try doing this entirely on the REPL:
- Use os.listdir to confirm that the file definitely exists.
- Once you've opened the image (make sure no exceptions are raised) have a look at the pixel data to see if it's what you expect.
- Does it work for other BMP files? Does the JPG in your example code work?
I have come from there but apart from myself, the admin are busy with makerfair.
It used a lobo's python while working on their own version of Mp.
Yes the default.jpg file appears.

I will try with repl.

Re: .BMP image issues.

Posted: Mon Jun 24, 2019 2:31 am
by Sean
image function support bmp and jpg format , then I saw your code, maybe try delete code "image1.changeImg("res/default.jpg")" , can I ask your use Micropython Framework version?

Re: .BMP image issues.

Posted: Tue Jun 25, 2019 5:12 am
by AJB2K3
I believe the current port uses MP 1.10.
I haven't had time to return to this code as I have been busy understanding other aspects of MP code.