Is the following function correct, this code is meant to add a phrase to image. Note that i cannot use image.text function or any other but can only use getpixel, putpixel, load, and save.
def insertTxtImage(srcImage, phrase):
pixel = srcImage.getpixel(30,30);
srcImage.putpixel(pixel,phrase);
srcImage.save;
pass
Yes it is homework which can only use getpixel, putpixel, load, and save to insert a phrase in to the image.
I tried to do this with this code but it is giving system error (argument is not a tuple)
def insertTxtImage(srcImage, phrase):
pix = srcImage.load()
pix[0,0] = phrase
srcImage.save()
pass
Thanks for the comments.