.BMP image issues.

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
AJB2K3
Posts: 11
Joined: Wed Mar 06, 2019 5:20 pm

.BMP image issues.

Post by AJB2K3 » Sun May 12, 2019 6:54 pm

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?

User avatar
jimmo
Posts: 327
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: .BMP image issues.

Post by jimmo » 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?

AJB2K3
Posts: 11
Joined: Wed Mar 06, 2019 5:20 pm

Re: .BMP image issues.

Post by AJB2K3 » Tue May 14, 2019 5:50 am

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.

Sean
Posts: 1
Joined: Mon Jun 24, 2019 1:59 am

Re: .BMP image issues.

Post by Sean » Mon Jun 24, 2019 2:31 am

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?

AJB2K3
Posts: 11
Joined: Wed Mar 06, 2019 5:20 pm

Re: .BMP image issues.

Post by AJB2K3 » Tue Jun 25, 2019 5:12 am

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.

Post Reply