What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-21 18:58:06
python cv2 screen capture
import numpy as np import cv2 from PIL import ImageGrab while True: img = ImageGrab.grab(bbox=(0, 1000, 100, 1100)) #x, y, w, h img_np = np.array(img) frame = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY) cv2.imshow("frame", frame) ... Add solution -
Python 2021-10-20 03:46:05
crop image python
from PIL import Image # import pillow library (can install with "pip install pillow") im = Image.open('card.png') im = im.crop( (1, 0, 826, 1125) ) # previously, image was 826 pixels wide, cropping to 825 pixels wide im.save('card.png') # saves ... Add solution -
Python 2021-10-18 06:00:08
python 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 2021-10-17 05:52:12
generate gif py
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