Announcement

Collapse
No announcement yet.

Serial: Loading PNG off uSD and displaying it

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial: Loading PNG off uSD and displaying it

    Using serial commander under Arduino with Diablo_Serial_4DLib

    The file "logo_big.png" does exist on the uSD.
    But the image does not display.

    The Diablo_Serial_4DLib lib works; I can Cls(), FindFile(), etc.

    Here's my code:
    Display.file_FindFirst("logo_big.png"); // This finds the file
    word handle = Display.file_Open("logo_big.png", 'r') ; // ACKs, Returned value is non-zero
    Display.file_Image(100, 100, handle) ; // ACKs, returned value is 0
    Display.file_Close(handle) ;

    Does the display work with PNGs?
    What image file formats does the display support?

    Thanks,
    -Dave

  • #2
    Hi Dave,

    Yes the display works with PNG image files, however they first have be be converted to a GCI format. This can be done in Workshop 4 by using the UserImage widget in Widgets System/Media.

    I hope this helps.

    Best regards

    Paul

    Comment


    • #3
      Dave,

      Here is the code I tested which shows the image:

      Display.file_Mount();
      word handle=Display.file_LoadImageControl("logo_big.dat","logo_big.gci",1);
      Display.img_Show(handle,0);

      Please create the logo_big.dat and logo_big.gci using Graphics composer.

      1. copy the logo_big.png to your uSD card with FAT16 file system
      2. click on Add the PNG file from your uSD card which is mounted in the PC by a card reader
      3. click on the PNG file
      4. Click on the Build button with an IC Icon
      5. on the Build type choose 4DGL-GCI FAT selected folder
      6. Click on OK

      Please take note on the filenames you use for the LoadImageControl is the
      same as the files in the uSD card generated by graphics composer.
      You can also use the Serial Commander to test it.

      Fare better and easier to use Workshop and a ViSi project and just build the program, but don't load it.


      Best regards,
      Last edited by Noel; 6th May 2017, 01:34 PM.

      Comment


      • #4
        Thanks for the replies.
        I am able to show .gci-based images as suggested above.
        I was wondering abouw raw PNGs, but it seems I must compile to .gci first, which is fine.

        Comment

        Working...
        X