python-resize-image unicode decode error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: python-resize-image unicode decode error (/thread-26091.html) |
python-resize-image unicode decode error - Pedroski55 - Apr-21-2020 I am trying this from pypi.org here: from PIL import Image from resizeimage import resizeimage fd_img = open('/home/pedro/backgrounds/pearlReflection.jpg', 'r') img = Image.open(fd_img) img = resizeimage.resize_contain(img, [827, 1169]) img.save('test-image-contain.jpeg', img.format) fd_img.close()I have tried other bits of their code and it worked. I am getting the error below and I don't know why, as I am trying to follow the pypi.org instructions exactly: Any idea what the problem is?? Quote:>>> pathTojpgs + jpgFiles[0] RE: python-resize-image unicode decode error - Pedroski55 - Apr-21-2020 Well, I got past that problem, after lunch, with this: Quote:>>> fd_img = open('/home/pedro/backgrounds/pearlReflection.jpeg', 'rb') But now I'm stuck on save: Quote:>>> img.save(name, img.format) How to get around this error?? RE: python-resize-image unicode decode error - snippsat - Apr-21-2020 Look at cannot write mode RGBA as JPEG (4.2.0) #2609 RE: python-resize-image unicode decode error - Pedroski55 - Apr-21-2020 Thanks, that fixed it: Quote:img = img.convert("RGB") After that it saved fine! |