What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-11 19:20:18
python pillow resize image
from PIL import Image # Image.open() can also open other image types img = Image.open("some_random_image.jpg") # WIDTH and HEIGHT are integers resized_img = img.resize((WIDTH, HEIGHT)) resized_img.save("resized_image.jpg") Add solution -
Python 2022-03-09 15:10:21
how to draw image in tkinter
from tkinter import * from PIL import ImageTk, Image root = Tk() c = Canvas(root, width=500, height=500) c.pack() img = ImageTk.PhotoImage(Image.open(r"imagepath\imagename.extension")) c.create_image(x, y, image=img, anchor=NW) Add solution -
Python 2022-03-06 09:35:39
couldn't recognize data in image file
# PIL solution from tkinter import * from PIL import ImageTk, Image tkFenster = Tk() canv = Canvas(master=tkFenster) canv.place(x=0, y=0, width=750, height=531) img = ImageTk.PhotoImage(Image.open("mond.gif")) # <-- PIL canv.create_image(... Add solution -
Python 2022-02-15 06:30:11
find most used colors in image python
from __future__ import print_function import binascii import struct from PIL import Image import numpy as np import scipy import scipy.misc import scipy.cluster NUM_CLUSTERS = 5 print('reading image') im = Image.open('image.jpg') im = im.resize((150, 15... Add solution -
Python 2022-02-06 21:50:20
im save to a bytes io python
from io import BytesIO from PIL import Image, ImageDraw image = Image.new("RGB", (300, 50)) draw = ImageDraw.Draw(image) draw.text((0, 0), "This text is drawn on image") byte_io = BytesIO() image.save(byte_io, 'PNG') Add solution
Best helpers
Ranking is empty