Answers for "python photoimage"

2

how to place image in tkinter

import tkinter 
from PIL import Image, ImageTk

load= Image.open("/Users/omprakash/Desktop/Gmail-new-logo.jpg")
render = ImageTk.PhotoImage(load)
img = Label(root, image=render)
img.place(x=100, y=100)
Posted by: Guest on January-11-2021
2

image tkinter

from tkinter import *      
root = Tk()      
canvas = Canvas(root, width = 300, height = 300)      
canvas.pack()      
img = PhotoImage(file="ball.ppm")      
canvas.create_image(20,20, anchor=NW, image=img)      
mainloop()
Posted by: Guest on May-17-2020
1

python display image

from PIL import Image, ImageFilter  # importing the image

#Image -1 DLC3 with Blur filter
img1 = Image.open('dlc3.jpg')
filtered_img1 = img1.filter(ImageFilter.BLUR)
filtered_img1.save('Blurdlc3.png')

#Image -2 DYONISOS with Smooth filter
img2 = Image.open('dyonisos.jpg')
filtered_img2 = img2.filter(ImageFilter.SMOOTH)
filtered_img2.save('dyonisossmooth.png')

#Image - 3 SHARK with convert and rotate properties
img3 = Image.open('shark.jpg')
filtered_img3 = img3.convert('L')
filtered_img3.rotate(180)
filtered_img3.save('Shark.jpg')
Posted by: Guest on June-16-2020
0

python image

import urllib.request
from random import *
import random,string
from selenium import webdriver

try:
    Image1 = driver.find_element_by_xpath('//*[@id="ivLargeImage"]/img').get_attribute('src')
    len1 = 10 #Will be the number of characters in image name
    letters1 = string.ascii_lowercase
    img1_name = ''.join(random.choice(letters1) for i in range(len1)) 	#making random names here
    full1_name = str(img1_name) + '.jpg'
    file1_path = 'C:UsersCordDesktop\' + full1_name
    urllib.request.urlretrieve(Image1,file1_path)
except:
    Image1 = 'No Image'
    full1_name = 'No Image'
    print(Image1)
Posted by: Guest on October-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language