Answers for "image module python"

6

python image library

from PIL import image

img = image.open('C:\Users\you\path\to\your\image.jpg')
pix = img.getpixel((100,100))
img.putpixel((0,0),(0,0,255))
Posted by: Guest on April-23-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:\Users\Cord\Desktop\\' + 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

Browse Popular Code Answers by Language