Skip to content

Create New Car Method to Show an Image on the Autoauto Car Screen #71

@IGardocki

Description

@IGardocki

I've been volunteering at the San Antonio Youth Code Jams for about 2 years. We had a request from a student at the Low Sensory Jam to display an image of a cat on the car's screen. Students really enjoyed being able to show their favorite image on the car (students displayed cats, the "67 kid", and a few others). It would be cool if there was a car.show_image(url) method that would take a url to an image as a argument and display the image on the car screen. Below is the code we used to make that work (this code displays an image of a cat). Unlike the code in my previous issue about GIFs, this doesn't include resizing, but resizing would probably be necessary so that the method could take in an image of any size and display it.

import car
from PIL import Image
import requests
import numpy as np
from io import BytesIO

url = "https://st4.depositphotos.com/11342552/41908/i/450/depositphotos_419081616-stock-photo-cute-little-red-cat-young.jpg"
response = requests.get(url)
img = Image.open(BytesIO(response.content)).convert("RGB")

cat_array = np.array(img)

car.plot(cat_array)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions