Home
Avocado emoji

Shrekify

A tool for Shrekification! Upload a pic of yourself and you'll get turned green.

Check it out!

First, you upload a picture. Then, when the "Shrekify" button is pressed, the image is shrunk (if needed, to avoid long processing times) and passed to an AWS lambda function, where it is read pixel by pixel to determine which ones to turn green. Afterwards, a simple face detection is done and Shrek ears are sized and placed using node-canvas. The image gets returned to the browser where it is displayed to be downloaded and/or shared.

A Shrekified Jesse:

A Shrekified Jesse

I did not write the code for detecting when pixels are "skin-colored" - I just converted it to TypeScript from this CodePen. Nor did I write the code for detecting faces, that was copied and adapted for the newest version of Node.js Canvas from face-detect.

It took quite a few tries to get this "right" - and even then, it's pretty bad. Here are some decisions that I made along the way:

Source code in the Github repository.