Search code examples
pythontkinterpython-imaging-librarycustomtkinter

Size of image in customtkinter inside a label


This is not error this is a help. I attached a PIL image in custom tkinter

cursor.execute("SELECT profileimg FROM dibusersdata WHERE username=? AND password=?", (username, password))
imag = cursor.fetchone()[0]
imgj = io.BytesIO(imag)
img = im.resize((300,300), Image LANCZOS)
imgg = CTkImage(img)

label = customtkinter.CTkLabel(master=frame, image=imgg, text='')
label.place()

i want the image to be resized and be big. How can i do it?


Solution

  • I noticed that you are using customtkinter, you can resize change the size of the picture by adding the size variable in the CTKImage function, here's how:

    imgg = CTkImage(img,size(600,600)
    label = customtkinter.CTkLabel(master=frame, image=imgg, text='')
    label.place()
    

    Assuming you want the label to be the same size as the image or you want the image to cover up the whole label:

    imgg = CTkImage(img,size(600,600)
    label = customtkinter.CTkLabel(master=frame, image=imgg, text='',width=600,height=600)
    label.place()
    

    If you need any other help please describe your problem in detail.

    Thanks!