bitbank2 / JPEGDEC

An optimized JPEG decoder for Arduino
Apache License 2.0
365 stars 47 forks source link

Adafruit GFX from SD #31

Closed el-samiyel closed 2 years ago

el-samiyel commented 2 years ago

Hi, great work and thanks for sharing.

Are you able to point me in the right direction as to how I can get this to run on the Adafruit GFX libs and read the image from an SD.

After many attempts, I get it to recognise the images on the SD, but they do not display on the ili9341.

I am actually using a teensy 4, however I am unable to use ILI9341_t3.h without having to re-write much of my existing project which is based off of the GFX libs. (The t3 slideshow example works)

Any help/direction will be most appreciated.

bitbank2 commented 2 years ago

Are you able to use the adafruit_gfx_demo sketch as a guide? (https://github.com/bitbank2/JPEGDEC/tree/master/examples/adafruit_gfx_demo)

el-samiyel commented 2 years ago

The guide does Dow. However when I create an image using your windows command line code, I just get a blank screen with no jpg displayed.

On Wed, 22 Dec 2021 at 14:04, Larry Bank @.***> wrote:

Closed #31 https://github.com/bitbank2/JPEGDEC/issues/31.

— Reply to this email directly, view it on GitHub https://github.com/bitbank2/JPEGDEC/issues/31#event-5804953344, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFACADNZ555J3UNAGD4X5LLUSHLH5ANCNFSM5KRGWYGA . You are receiving this because you authored the thread.Message ID: @.***>

bitbank2 commented 2 years ago

Check return codes - you many be trying to display a progressive JPEG. It needs to be baseline

bitbank2 commented 2 years ago

image_to_c works correctly. I can't debug the problem with the little bit of info you provided. Return codes to check are from the JPEGDEC class methods. I can take a look if you share the actual code you're using. I know my library works reliably, so it's highly likely that you made a simple mistake in your code.

el-samiyel commented 2 years ago

Understood, yes probably me doing something wrong.

Code attached. Id appreciate your feedback.

When I run under thumb_test,h it works fine, and the images change as expected. When I replace with b.h or c.h, i get a blank screen..

adafruit_gfx_demo_issue.zip

el-samiyel commented 2 years ago

Here are the images I was testing with using (image_to_c64.exe):

images.zip

el-samiyel commented 2 years ago

Ideally, as per my original post, id like to load the images directly from the SD, without the need to convert them using the tool. But my attempt at a conversion from the ili9341_t3_slideshow to using the adafruit libs also failed. I'm presented with the jpeg files being read out on the display in yellow, but no images on the screen.

Code also attached for your consideration. I am probably missing something silly.

adafruit_from_sd_attempt_slideshow.zip

Many Thanks

bitbank2 commented 2 years ago

The image_to_c tool allows you to link image data into your sketch as "const" data in FLASH. It has nothing to do with image data loaded from media at run time.

el-samiyel commented 2 years ago

The image_to_c tool allows you to link image data into your sketch as "const" data in FLASH. It has nothing to do with image data loaded from media at run time.

Understood, yes I was saying that I tried both ways. Loading from flash using the image_to_c tool, and I tried to load from the SD as it was done in the ili9341 teensy slid show example.

I get a black screen when loading from flash, as per my 1st attachment. (works fine with thums.h but not with any jpg code I generate using the tool)

I get a black screen while trying to load from the SD as per my 3rd attachment. (works with ili9341_t3.h but not with the adafruit ili9341 lib)

Thanks

bitbank2 commented 2 years ago

You're not checking any return codes. You're not checking the image dimensions after a successful open. You also forgot to issue a tft.startWrite() before accessing the LCD. By not activating the CS line of the LCD, all writes will be ignored.

el-samiyel commented 2 years ago

You're not checking any return codes. You're not checking the image dimensions after a successful open. You also forgot to issue a tft.startWrite() before accessing the LCD. By not activating the CS line of the LCD, all writes will be ignored.

Hi, I still don't understand how to check the return codes. do you have an example?

bitbank2 commented 2 years ago

See https://github.com/bitbank2/JPEGDEC/blob/8ad3a9cba79c7e3dafa62fb6fa8786d3046eba95/examples/epd_demo/epd_demo.ino#L99

If an error occurs on JPEG.open or JPEG.decode you can call getLastError() to see what went wrong.

el-samiyel commented 2 years ago

See

https://github.com/bitbank2/JPEGDEC/blob/8ad3a9cba79c7e3dafa62fb6fa8786d3046eba95/examples/epd_demo/epd_demo.ino#L99

If an error occurs on JPEG.open or JPEG.decode you can call getLastError() to see what went wrong.

Splendid, got it. Cheers Larry.

Thanks for taking the time to help me think.

Many Thanks