View Single Post
Old 06-05-2019, 09:35 PM   #76
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
He's inadvertently thumbnailing self.img with PIL (to display it in the Tk widget). So when self.img.size is called later on, the new smaller thumbnail size is the one being returned.

Lots of different ways to tackle correcting it. A down-and-dirty-way to get it going would be to make a few similar changes in two different locations.

In plugin.py (latest version) starting with line #255 change:
Code:
self.img = Image.open(BytesIO(bkImage))
size = 400, 400
self.img.thumbnail(size, Image.ANTIALIAS)
self.photo = ImageTk.PhotoImage(self.img)
to:
Code:
img_temp = Image.open(BytesIO(bkImage))
self.img = img_temp.copy()
size = 400, 400
img_temp.thumbnail(size, Image.ANTIALIAS)
self.photo = ImageTk.PhotoImage(img_temp)

And in plugin.py line #275 (before the above change) change:
Code:
self.img = Image.open(filehandle.name)
size = 400, 400
self.img.thumbnail(size, Image.ANTIALIAS)
self.photo = ImageTk.PhotoImage(self.img)
to:
Code:
img_temp = Image.open(filehandle.name)
self.img = img_temp.copy()
size = 400, 400
img_temp.thumbnail(size, Image.ANTIALIAS)
self.photo = ImageTk.PhotoImage(img_temp)

Last edited by DiapDealer; 06-05-2019 at 09:55 PM.
DiapDealer is offline   Reply With Quote