I'm starting to work with image processing and I need to do a simple exercise to double the size of one.
I have the following script:
from PIL import Image
imagem = Image.open("local_da_Imagem", "r")
largura, altura = imagem.size
fator = 2
W = largura
H = altura
nova_largura = int(largura*fator)
nova_altura = int(altura*fator)
nova_imagem = Image.new("RGB", (nova_largura, nova_altura))
for col in range(nova_largura):
for row in range(nova_altura):
p = imagem.getpixel((col, row))
nova_imagem.putpixel((col*fator, row*fator), 100)
nova_imagem.show()
But when I run this script, I get the error: IndexError: image index out of range.
Someone could help me. Showing me where I'm going wrong in this script?
I thank all those who can.