[Python] Trying to display images with PIL and BytesIO but returns nothing

Discussão em 'Python' iniciado por Stack, Agosto 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to display the logos from a dataset. The dataset looks like this:

    Player Club Logo
    tom https://abc.png
    jerry https://def.png
    peter https://frf.png
    woody https://awt.png


    However, it didnt return me any logos. All it did show was 4 empty grid boxes. My code is below. I also did try to use im = Image.open(BytesIO(r.content)).show() but the logos ended up opening on my computer instead.

    import matplotlib.pyplot as plt
    import requests

    from PIL import Image
    from io import BytesIO

    fig, ax = plt.subplots(2,2, figsize=(2,2))

    for i in range(4):
    r = requests.get(df['Club Logo'])
    im = Image.open(BytesIO(r.content))

    plt.show()


    Thanks

    Continue reading...

Compartilhe esta Página