🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Core S3 SE images won't show

    UiFlow 2.0
    4
    11
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • greenleafG
      greenleaf
      last edited by

      I'm trying to build a really simple program to test the device. Unfortunately it's failing to even show a simple JPG or PNG image. What am I missing here?

      def setup():
        global image0, circle0, label0
      
        M5.begin()
        Widgets.fillScreen(0x222222)
        image0 = Widgets.Image("res/img/mushroom.jpg", 85, 52, scale_x=1, scale_y=1)
        circle0 = Widgets.Circle(45, 44, 15, 0x636eec, 0xdaf239)
        label0 = Widgets.Label("mushroom", 115, 206, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
      
        image0.setImage("res/img/mushroom.png")
        image0.setVisible(True)
      
      greenleafG 1 Reply Last reply Reply Quote 0
      • greenleafG
        greenleaf @greenleaf
        last edited by

        @greenleaf Here's a screenshot. I've tried both a small PNG image and a small JPG image. Neither one ever shows up on the screen.

        (screenshot.png image url)

        J felmueF 2 Replies Last reply Reply Quote 0
        • J
          jeanfabre @greenleaf
          last edited by

          @greenleaf I have the exact same problem on the m5dial (https://community.m5stack.com/topic/6829/can-t-get-m5dial-to-display-an-image-loaded-via-uiflow2). I hope someone is going to reply soon, because I think either the documentation is not mentionning an important aspect for producing valid png or jpg, or something is odd. But at the same time, I could not even find a working project online that would actual render an image on my m5dial...

          1 Reply Last reply Reply Quote 1
          • felmueF
            felmue @greenleaf
            last edited by

            Hello @greenleaf

            in order for the image to show on the actual device it needs to be manually downloaded to the device into the correct path, e.g. res/img.

            UIFlowPNGDownload_20240926.png

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            J greenleafG 2 Replies Last reply Reply Quote 0
            • J
              jeanfabre @felmue
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • greenleafG
                greenleaf @felmue
                last edited by

                @felmue ok, then UIFlow 2 has a bug in it, it seems. I used the UI to upload and select the image. If it's being put in the wrong folder that is confusing for users.

                felmueF 1 Reply Last reply Reply Quote 0
                • felmueF
                  felmue @greenleaf
                  last edited by

                  Hello @greenleaf

                  I would agree, by default images (actually any files for that matter) are uploaded into the root folder whereas the image is expected to be in res/img which only becomes obvious when looking at the Micropython source code.

                  Thanks
                  Felix

                  GPIO translation table M5Stack / M5Core2
                  Information about various M5Stack products.
                  Code examples

                  greenleafG 1 Reply Last reply Reply Quote 0
                  • greenleafG
                    greenleaf @felmue
                    last edited by

                    @felmue

                    Ok I took a closer look - the files don't even make it onto the device at all.

                    Is this perhaps an unfinished feature? I would expect that when I upload files into a "project" that they end up on the device somewhere. I don't see a way in the UI to move files from the project to the device, so I have to upload them all again.

                    Is this by design? Or did I run into a missing feature or bug...projectfiles.png devicefiles.png

                    greenleafG 1 Reply Last reply Reply Quote 0
                    • greenleafG
                      greenleaf @greenleaf
                      last edited by

                      @greenleaf

                      Ok, I found a workaround. Here it is in case anyone else runs into this:

                      1. Use the WebTerminal File button to upload your images into /flash/res/img
                      2. Edit the paths to any of your images in code to /flash/res/img/yourfile.jpg

                      e2a73da5-09fa-405b-827f-b70eae4bda3b-image.png

                      0f5b8f0c-0327-4f02-90bb-65a233fd528b-image.png

                      greenleafG 1 Reply Last reply Reply Quote 0
                      • greenleafG
                        greenleaf @greenleaf
                        last edited by

                        @greenleaf Final update, it appears that if you upload the images both to the project and onto the device directly, that you can use the UIflow way to place them and resize them, etc.

                        I did find some weirdness with older versions of images being cached on the UI, but correct on the device.

                        1 Reply Last reply Reply Quote 0
                        • lbuqueL
                          lbuque
                          last edited by

                          https://uiflow-micropython.readthedocs.io/en/latest/quick-reference/usb-mode.html

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post