Image grayscale conversion
Convert RGB color images to grayscale and save them in-place, overriding the original files. Use this skill whenever the user asks to convert images to gray-scale, desaturate photos, or prepare images for grayscale processing pipelines using OpenCV or Pillow.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill image-grayscale-conversionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.2 KB, 238 tokens by cl100k_base, as published. Nobody here has run it
In-Place Image Grayscale Conversion
Convert one or more color (RGB) images to grayscale, overwriting the original files.
Using OpenCV (recommended)
import cv2
import glob
image_paths = sorted(glob.glob('/root/keyframes_*.png'))
for path in image_paths:
img = cv2.imread(path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imwrite(path, gray)
cv2.imreadloads image as BGR by default.cv2.COLOR_BGR2GRAYconverts to single-channel grayscale.cv2.imwritesaves back to the same path, overwriting the original.
Using Pillow
from PIL import Image
img = Image.open(path).convert('L')
img.save(path)
Notes
- After conversion the file is a single-channel (8-bit) PNG — verify with
cv2.imread(path).shapewhich should show(H, W)instead of(H, W, 3). - Grayscale images are required for many template-matching and feature-detection algorithms.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.