Skip to content
Advertisement

Tag: python-imaging-library

How to make a circle using PIL?

As the title says I want to draw a circle in PIL but the output isn’t a circle The output: https://i.stack.imgur.com/qlYmD.png Code: I want to know how can I fix this problem. Answer To draw a circle of radius 50 with center at (150,150): To the ellipse you have to provide Two points to define the bounding box. Sequence of

Change contrast and sharpness of a Picture in Python

I’m new to coding, some my code isn’t the cleanest (as evidenced below). Is there a more efficent way to change both the sharpness and contrast with Pillow in python without having to save and open the file twice? My horrible code: Answer You can do it without saving to disk like this: Transforms this: into this:

“Pillow was built without XCB support”

I’m working on a program that uses ImageGrab in Pillow. I am getting the error mentioned in the title. I notice in the documentation that it says the generic pip install Pillow doesn’t come with libxcb. I tried installing libxcb with pip install libxcb, but it apparently doesn’t exist as that. I tried looking around on Google for it, but

Is possible to link an online font file to PIL ImageFont.truetype()?

Instead of downloading the font locally and link it to ImageFont.truetyp() to be like this: Can I do something like this: Answer ImageFont.true_type takes a file-like object. Python’s standard library, urllib.request.urlopen returns a file-like object. The following should work: edit: As @flyer2403 answered, to make that particular url work you need to add ?raw=true to the end.

pyOpenGL 2D Image drawn skewed

I am trying to draw a 2d image in OpenGL using pillow to load the image, but when I render it in OpenGL, the image is skewed. This is the original image: Loading.png This is the code: Result As you can see, the result is a skewed image, I don’t know why this is happening, and I can’t see the

Advertisement