Skip to content
loading...

How to (up || down)scale a tkinter PhotoImage?

calin92540842 profile image PDS OWNER CALIN (Calin Baenen) twitter logo github logo ・1 min read

RuntDeale (5 Part Series)

1) My Undertale fan-game (RuntDeale)'s logo 2) How to stop image stretching/smoothing (anti-aliasing) in Chrome canvas 3) (RuntDeale website setup) -- RuntDeale talk 4) How to (up || down)scale a tkinter PhotoImage? 5) How to use custom font with Python Tkinter Canvas?

So I figured out how to draw an image,
but now, how do I resize my existing image?
When I looked it up, I got how to use Image, which said to do something like

img = Image.open(IMG_LOCATION)
image = image.resize((250, 250), Image.ANTIALIAS)
self.pw.pic = ImageTk.PhotoImage(image)

but is there any way to do this without 1, affecting the original image, and 2, without going through this long convoluted process?

Here's part of an original snippet for reference:

RUNTDEALE_LOGO = PhotoImage(file="resources/textures/logo/logo.png")

ctx.create_image((100,100),image=RUNTDEALE_LOGO)

Thanks!
Cheers!

twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Dec 17 '19

Landing the First Job

Part 4 of DEV Student Series

PDS OWNER CALIN (Calin Baenen) profile image
I am a 13 (as of Oct 30 of 2019) yr/o developer (I have been developing mini-projects for 4, years now, since I was 9), who makes projects in languages like: Java, HTML, Python 3, JS, CSS, and C#.