Consider the following screenshot of a code snippet:

Let’s say I want to extract the code from the image. I don’t want to type it out. What can I do?
I just discovered that Google Bard has sufficient image recognition skills that you can upload images and ask it to extract the code from the image.
Step 1: Visit Bard
First, visit the https://bard.google.com website and create an account if you haven’t already. If you already have a Google account, this will take two minutes or less.

Step 2: Upload the Code Image (PNG, JPEG, WebP) Into a Prompt
Second, click the small +
icon at the bottom of the page to upload your code screenshot

Then choose the code screenshot as a JPEG, PNG, or WebP file form your computer folder and click "Open"
.

Step 3: Enter Code Recognition Prompt
Now enter the prompt "Give me the code in the image"
or a similar one in the prompting textbox and click submit on the bottom right of your chat window.

Step 4: Copy&Paste Code
Bard has figured out the code from the image! You can now copy and paste it easily by clicking the double paper icon 📄 on the left of the output.

Fantastic, you can use Bard to recognize code (e.g., Python) in an image. That’s currently not natively integrated into ChatGPT!
If you want to stay updated with the current AI disruption, join 150k Finxters by downloading our cheat sheets:
Also, feel free to check out this article you’ll enjoy (I bet)! 👇
💡 Recommended: GPT-4 Code Interpreter – How to Run Python & Plot Data in ChatGPT

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.