How to pixelate or render an image in Blender?

Pixel art is a popular artform and being able to convert your renders to a pixelated version can be a cool feature. An image can be pixelated or render using compositor in Blender.

To pixelate an image or render in Blender using the compositor follow these steps:

Steps to Pixelate an Image in Blender

Step 1: Go to the compositor and check use nodes.
Step 2: Add two scale nodes and a pixelate node in between.
Step 3: Put an image or render layer output in the image input of the first scale node.
Step 4: Plug a value node into both the X and Y of the first scale node and set it to a low value like 0.04.
Step 5: Plug the value node into the lower socket of a math node and set it to divide.
Step 6: Change the top value in the math divide node to 1.
Step 7: Plug the math value output into the X and Y input sockets of the second scale node.
Step 8: Plug the last scale node into a viewer/composite node to output the result to the backdrop and for saving the final result.
In the image below you can see the full node setup. Click the image to open it in full resolution.

What is Pixelate node setup?

We can pixelate any image by bringing in an image node and browse our hard drive for the image we want to pixelate. But in this case you can use the Cube Diorama from Blender.org.

I modified the scene and rendered it against a transparent background. But any kind of background will do.

Next we input our render layer or image into a scale node. While set to relative this nodes scales the image to a percentage of the original image. Today we are dealing with quite large images. In this case I rendered in 2048 by 2048. We then scale that down to 4% of the original size to get a good amount of pixelation.

To get a good amount of pixelation I found that a value between 0.01 and 0.2 is a reasonable range.

But if we output the image from the first scale value we will see that our image will be scaled down but the original size of the image itself will be maintained.

To solve this we need to scale the now small image back up. But if we do so with a second scale node, the details of the original image is maintained.

Therefore we need to add the pixelate node that stores the scaled down version of our image. We can then scale this back up using a second scale node.

However to maintain the original size it is important that we scale up to the correct value or the original size and the pixelated image size won’t match.

Therefore we need to make sure that there is a relationship maintained between the x and y input of the first scale node and the second.

The relationship is such that when we for example scale down to 0.2 we need to multiply by 5 to get back to a scale of 1 which is our original scale. This means that to get back to the original size we need to find a number that when multiplied by the input value into the first node will become 1.

We can do this by dividing 1 by the input value of the first node to get the scale value for the second node.

The value node then simply decides how much pixelation we want and the value input into the second scale node is automatically adjusted to match the original scale.

We could also use power and set the exponent to -1. Any value raised to the power of -1 means the same thing as 1 divided by the base of that expression.

Steps to Save a Pixelated Image

Step 1: To save our pixelated image we can go to the image editor or press F11 to bring up the render result.

Step 2: Go to image->Save or save as.

Tip: However when we save our image we will save it in the original resolution. So if we rendered at 2048 by 2048 this is the resolution we will output even if we pixelated our image.

If we simply render an image and want to directly output it in a pixelated format that also has the lower resolution so that it can perform as good as it can. For example in a game using pixel art, we will run into trouble.

The way the render engine works will create a blurry result if any at all. However there is a simple workaround we can apply to the node setup we have above.

At the end of the node tree add another scale note and set it to render size. Then go to the output setting and change the output resolution to your desired resolution. The best is if this is the same resolution as the one you use in your first scale node so that the output match the downscaled version exactly.

To do this we can keep the original resolution and set the resolution percentage. For example, if our value node in the compositor is set to 0.04, that will result in a downscale to 4% of the original resolution.

Therefore we can simply change the resolution percentage to 4 in this case to match the value in the compositor.

Next we plug the last scale node into the viewer node and go to the image editor or press F11.

In the image selector at the top of the image editor, chose the viewer node. Press N to bring up the right side properties panel and go to the image tab. Make sure that the image output resolution of the viewer node is correct. You can see it in the image section.

Next go to image->Save and save your image.

Keep in mind that it is important that we use the viewer node in the image editor instead of the rendered result. The rendered result won’t change it’s resolution without first rendering a second time. Something that we cannot do since we need the high resolution image in the compositor.

If we for some reason needed to use the render result instead, we would have to save the high resolution render result to disk first and bring it back in using an image node.

How to bring a pixelated image as a texture in Blender?

If we want to bring our pixelated image in as a texture follow these steps:

Open the shader editor with the material you would like to add the image texture to.
Add an image texture node and browse for the pixelated image.
Change the interpolation from linear to closest. This is the first drop down menu on the image texture node.
Connect the image texture to the principled BSDF base color.

Now, It’s Over to You

We also learned that the image is still saved in the rendered resolution and if we need to have a lower resolution image with the pixelated result we can use an additional scale node and use it together with the viewer node to save the lower resolution result.

Leave a Reply

Your email address will not be published. Required fields are marked *