Couldn't load image into py5

Hi, I’m a new user and just begin learning py5 in school, I’ve run the code with no errors appeared, but the sketch is blank, could anyone help me figure out the problem? Thank you so much!

<

size(600,600)
background(‘#2d2d2d’)
#color_mode(HSB,50)
#no_stroke()

tint(random(100),random(100),random(100))
cat = load_image(‘C:/Users/lenovo/Downloads/clipart1322749.png’)
image(cat,0,0)

1 Like

Cheers @Lyra!

I find it curious that you don’t seem to get any error message, is that so?

For instance, I get an error message because I don’t have the `lipart1322748.png’ file at the right place…

The file "C:/Users/lenovo/Downloads/clipart1322749.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
py5 encountered an error in your code:
    3    #color_mode(HSB,50)
    4    #no_stroke()
    5    
    6    tint(random(100),random(100),random(100))
--> 7    cat = load_image('C:/Users/lenovo/Downloads/clipart1322749.png')
    8    image(cat,0,0)

RuntimeError: cannot load image file C:/Users/lenovo/Downloads/clipart1322749.png. error message: either the file cannot be found or the file does not contain valid image data.

Otherwise, it I stick my own image, it kind of works… but it got very very dark…

I wonder if your image is very big and has a plain part in the top left, could it be working but just showing dark gray?

Can you try image(cat, 0 ,0, width, height) and turn off the tint line with # maybe?

2 Likes

Yes, it works!!Thank you so much!!! :laughing:

2 Likes