element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Displaying a jpeg image with a RPI Pico
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 10 replies
  • Subscribers 658 subscribers
  • Views 7448 views
  • Users 0 members are here
Related

Displaying a jpeg image with a RPI Pico

scottiebabe
scottiebabe over 2 years ago

It is easier than ever to display a jpeg image using Pimoroni's version of micropython https://github.com/pimoroni/pimoroni-pico 

The code is easy-peasy:

# Display an image on a pimoroni Pico Display
# -Scottie 2022
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY, PEN_RGB332
import jpegdec

# PEN_RGB332 is an 8 bit, fixed 256 colour palette which conserves your RAM.
# Try switching the pen_type to PEN_RGB565 (16 bit, 65K colour) and see the difference!
display = PicoGraphics(DISPLAY_PICO_DISPLAY, pen_type=PEN_RGB332, rotate=0)

# Create a new JPEG decoder for our PicoGraphics
j = jpegdec.JPEG(display)

# Open the JPEG file
j.open_file("e14scottie.jpg")

# Decode the JPEG
j.decode(0, 0, jpegdec.JPEG_SCALE_FULL)

# Display the result
display.update()

And, ta-da Tada

image

The image I used for reference:

image

The Image is 240x120 pixels and in jpeg format has a file size of 16 KB. 

Pimoroni have done a number of update to the Picographics python module in the last year. This image was displayed in a 332RGB color format. I am totally impressed how well the colors rendered with such a limited color depth. 

  • Sign in to reply
  • Cancel
  • dougw
    dougw over 2 years ago

    Cool. Pimoroni has a bunch of other displays. Are they all selectable?

    I think I have a HyperPixel 4" kicking around.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • ntewinkel
    ntewinkel over 2 years ago

    Oh that is so cool!

    My first thought was “how do you get the image into the sketch”, thinking Arduino style… then I realized that the Pico just uses a file system! Nice!

     And I love love love it when the hardware creators actually take the time to include quality software.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 2 years ago in reply to dougw

    Thanks! It is my understanding you can use the picographics library for any of there spi displays! It is totally awesome Grinning

    I'm not sure about the hyperpixel 4

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 2 years ago in reply to ntewinkel

    Thanks! I think this super cool too Heart eyes

    Yes, I should have noted I had to upload the image with thonny.

    Yes! Pimoroni are doing amazing work at making the PI Pico the best $4 development board ever! All credit goes to them Slight smile

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • phoenixcomm
    phoenixcomm over 2 years ago

    scottiebabe Very Cool, I am impressed even though I have a distaste for Python and it's a throwback to Fortran. While it is very similar to C it has no end of a statement ala the; ie semicolon. This means more work on the programmer (me).

    I believe in structured code, but not this. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to phoenixcomm

    I'm changing my mind on this. I'm still not a Python fanboy. But the more I look into well written Python project code, the more I get to appreciate it as a language.
    extra win: the libraries that are out there in the wild. 

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • ntewinkel
    ntewinkel over 2 years ago in reply to phoenixcomm

    I can live without the semicolons, but the use of indentation to mark off blocks really bugs me.

    Overall I still like it for fun quick projects, but I don’t think I would use it for anything serious. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to ntewinkel

    It bugs me too. But every language has things that rub me the wrong way.

    One day, you have to grow <>, and look at the values instead of the pet peeves.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • ntewinkel
    ntewinkel over 2 years ago in reply to Jan Cumps

    I completely agree.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • phoenixcomm
    phoenixcomm over 2 years ago in reply to Jan Cumps

    Jan Cumps, My Gd. that's kind of nasty. Personally, I write in several languages. I will rate them and also tell you why.

    1. ANSI & K&R C. Great Language, Extensible, but easy to shoot yourself in the head if you are not careful. 
    2. FORTRAN is almost dead used a lot in aeronautics. 
    3. JAVA Nice language for building large software, interrupts are much easier than the C versions.
    4. PERL yes, this terrifies me but it has an sht-ld of a library. CPAN, variables are unitless! But for web dev and interfacing to DBM its worth the crud... one of my personal hatreds is the "my $varname; "
    5. APL neet language don't remember much of it. 
    6. Assembly Language(s) are all very similar, BUT DON'T GO NEAR  SPARC with over 100 registers to play with you better have a plan the C compiler is easier on the brain.  My favorite is the Motorola 6K stuff as it is still the only computer that was orthogonal. which means you can do this in one line of assembly code C++ = A++ * B--;  gee looks like C doesn't it. 
    7. Arduino IDE written in C++ is a mess! and Don't like it. And it scoping rules make me nauseous. 
    8. --- Python, get rid of the stupid intentions and add back in the dam ';" as the end of the line then I would use it. It reminds me of a C interpreter. 

    Jan instead of <> try >< and fly...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube