Patrick Matte Creative Coder

Color halftone filter for canvas 2D

My last project required applying a color halftone filter to uploaded user photos.

After a quick search on google, the only thing I found was a webGL shader but what I needed was a filter for 2D canvas, even if it would be performing much slower. So I finally had to write the filter myself.

Give it a try below and also play with the dot size slider for different results but remember that the smaller the dots, the longer it will take to render.

Download the source on GitHub

4 comments on “Color halftone filter for canvas 2D”

  1. Thanks. You could easily remove the CMY dots and just keep the K. Drawing only the black dots would be 75% faster.

    You might also want to use a library like glfx if you need to have a really fast rendering and your project can afford to use the webgl technology.

Comments are closed.