What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-31 20:10:06
kivy display PIL image
from kivy.core.image import Image as CoreImage from kivy.uix.image import Image as kiImage from PIL import Image, ImageDraw, ImageFont from io import BytesIO canvas_img = Image.new('RGB', (240, 120), color=(255, 255, 255)) (do stuff to canvas_img) data =... Add solution -
Python 2022-01-23 08:15:31
pyplot rectangle over image
import matplotlib.pyplot as plt import matplotlib.patches as patches from PIL import Image im = Image.open('stinkbug.png') # Create figure and axes fig, ax = plt.subplots() # Display the image ax.imshow(im) # Create a Rectangle patch rect = patches.Re... Add solution -
Python 2022-01-23 06:40:49
flask decoding base 64 image
from PIL import Image from io import BytesIO import base64 data['img'] = '''R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLl N48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw==''' im = Image.open(BytesIO(bas... Add solution -
Python 2022-01-23 04:30:08
image classification web app using stramlit
import cv2from PIL import Image, ImageOpsimport numpy as npdef import_and_predict(image_data, model): size = (150,150) image = ImageOps.fit(image_data, size, Image.ANTIALIAS) image = np.asarray(image) img = cv2.cvtColor... Add solution -
Python 2022-01-22 23:30:02
convert opencv image to pil image
import cv2 import numpy as np from PIL import Image img = cv2.imread("path/to/img.png") # You may need to convert the color. img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) im_pil = Image.fromarray(img) # For reversing the operation: im_np = np.as... Add solution -
Python 2022-01-22 17:30:02
how to save an image with the same name after editing in python pillow module
import os from PIL import Image PATH = "F:\\FYP DATASET\\images\\outliers Dataset\\Not Outliers\\" Copy_to_path="F:\\FYP DATASET\\images\\outliers Dataset\\" for filename in os.listdir(PATH): img = Image.open(os.path.join(PATH, f... Add solution -
Python 2021-11-18 22:15:16
make gif from images in python
from PIL import Image import glob # Create the frames frames = [] imgs = glob.glob("*.png") for i in imgs: new_frame = Image.open(i) frames.append(new_frame) # Save into a GIF file th... Add solution
Best helpers
Ranking is empty