I am new to Python and tried to run the following code. I got the following error "IOError: cannot open resource" . Is this because some of the image features no longer exist (e.g. Coval.otf), or is it potentially due to write / read restrictions? please let me know - thank you very much, W
import numpy as np from PIL import Image, ImageDraw, ImageFont from skimage import transform as tf def create_captcha(text, shear=0, size=(100,24)): im = Image.new("L", size, "black") draw = ImageDraw.Draw(im) font = ImageFont.truetype(r"Coval.otf", 22) draw.text((2, 2), text, fill=1, font=font) image = np.array(im) affine_tf = tf.AffineTransform(shear=shear) image = tf.warp(image, affine_tf) return image / image.max() %matplotlib inline from matplotlib import pyplot as plt image = create_captcha("GENE", shear=0.5)
python io python-imaging-library
user1885116
source share