[Python] Converting an Image to numpy array, then converting it immediately back to an image...

Discussão em 'Python' iniciado por Stack, Maio 13, 2025.

  1. Stack

    Stack Membro Participativo

    As the title states I'm converting my image to a numpy array then converting it right back. Here's my code:

    import os
    import numpy as np
    from PIL import Image
    img = Image.open(os.path.join(no_black_border, png_files[0]))
    img.show()

    np_arr = np.asarray(img)
    img1 = Image.fromarray(np_arr)
    img1.show()


    Here's my before converting it Here's my after converting it back

    Continue reading...

Compartilhe esta Página