A Python 3 module that uses Pillow to give images a halftone effect (see below for examples).
Running it over large images, or with settings that create large images, can take some time.
Also see Clay Flannigan's halftone in case that suits your needs better.
import halftone h = halftone.Halftone('/path/to/myimage.jpg') h.make()
Will create a new image at
/path/to/myimage_halftoned.jpg, using the default settings.
There are a number of options that can be added to the
make() call, e.g.:
The full list of options:
A list of 4 angles, in degrees, that each channel (CMYK, in that order) should be rotated by. If
style='grayscale' only the first angle is used. Experimenting with different angles can increase or reduce moiré patterns. More on screen angles.
A boolean value, indicating whether the circles drawn should be antialiased. Because Pillow doesn't draw antialias shapes, this is done by drawing the image at 4x the size and then reducing it to the desired size, antialiasing as part of the process.
When saving the new image, this string will be added to the original filename. e.g. if the original filename is
filename_addition='_halftoned', the saved file will be
How much of the gray component to remove from the CMY channels and put in the K channel.
When creating each circle in the new image, what area of pixels should that circle represent?
Scale of the output image. The maximum output dot diameter is
sample * scale (which is also the number of possible dot sizes).
'grayscale'. For color, four screens are output, one each for cyan, magenta, yellow and black. For grayscale, only black dots are generated, only the first number in the
angles list is used, and the
percentage value is ignored.
An example of
make() using all options:
h.make( angles=[15, 75, 0, 45], antialias=True, filename_addition='_new', percentage=50, sample=5, scale=2, style='color' )
examples/ directory for the example images below.
Other than the
filename_addition option, the images below have been created
using the options specified.
Custom screen angles
Using different screen angles to reduce moiré (but resulting in a different pattern).
h.make(angles=[15, 45, 0, 75])
Reducing the sample size and increasing the scale (to increase output detail).
With antialiased circles.
Black and white, setting the angle to 45 (the default angle would be 0, resulting in circles being in rows and columns).