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

    What is JPEG_DIV_NONE?

    Arduino
    3
    3
    2.8k
    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.
    • J
      jterrell
      last edited by

      From the documentation:

      bool drawJpg(const uint8_t *jpg_data, size_t jpg_len, uint16_t x = 0,
      uint16_t y = 0, uint16_t maxWidth = 0, uint16_t maxHeight = 0,
      uint16_t offX = 0, uint16_t offY = 0,
      jpeg_div_t scale = JPEG_DIV_NONE);

      What are all of these options, especially JPEG_DIV_NONE?

      canvas.drawJpgFile(SD, "/WFH.JPEG", 0, 0, 0, 0, 0, 0, "JPEG_DIV_NONE");

      Can someone help me with this line of code? I want to have a jpg image show in a specific location on the canvas.

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3 @jterrell
        last edited by

        @jterrell You have to bare with me as I just woke up but I believe the options are as follows:

        canvas.drawJpgFile(File name and location, X Position, Y Position, Width, Height, X offset, Y offset, "Jpeg Scaling");

        Maxheight limits the visible size of the image setting to 0 means no limit
        jpeg_div_t scale = JPEG_DIV_NONE is used to alter the size that the image is show for example if you want the image to be shown smaller then what it was downloaded, set it to
        jpeg_div_t scale = JPEG_DIV_50
        if you want it bigger set it to
        jpeg_div_t scale = JPEG_DIV_150

        Its similar to the issue I found in this guide https://www.hackster.io/AJB2K3/lvgl-forum-data-display-061a3c

        but Im not sure if it should be
        jpeg_div_t scale = JPEG_DIV_50
        or
        jpeg_div_t scale = JPEG_DIV_(50)

        I don't work in Arduino so not positive here.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        P 1 Reply Last reply Reply Quote 0
        • P
          PeterO @ajb2k3
          last edited by

          @ajb2k3 Had the same question and here the answer:

          jpeg_div_t scale = JPEG_DIV_2;
          // JPEG_DIV_NONE,  --> no scale
          // JPEG_DIV_2,    --> half the size
          // JPEG_DIV_4,
          // JPEG_DIV_8,
          // JPEG_DIV_MAX
          
           M5.Lcd.drawJpgFile(SD, filename.c_str(), 0, 0, 320, 240, 0,0, scale);
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post