Monday, July 13, 2020

Pixelating an image

I was thinking of ways of pixelating an image, using simple Python functions. I started with an image of white noise and ran the pixelation function.


The trick I found is simple. You resize the image to a much smaller size, then resize it back to the original size. We can see this in the code. Below are the actual images, the one used as input and the one that came out as output.

"Image.NEAREST" is key here. It's nearest neighbor interpolation that is being used when you resize back up to the original size.

NOISEFIELD_200.png

As always, we start with Gaussian white noise. Then we use the basic image processing functions and get the following.

Pixelated image, result.png


I'm trying to build an app that can generate noise images and then use different functions to "modulate the noise field" as I like to call it. Pixelation is one of the basic image processing functions that I want to have in my future app.


A.G. (c) 2020. All Rights Reserved.