DEV Community

dimaland1
dimaland1

Posted on

Creating Pixel Art with Python and PIL Library

Introduction

Pixel art is a digital art form where images are created at the pixel level. In this article, I'm going to show you how I used Python and the PIL (Python Imaging Library) to transform images into pixel art using a predefined color palette.

Concept

The project involves taking an input image, resizing it to fit a 100x100 pixel grid while maintaining its aspect ratio, and then applying a custom color palette. The result is a colorful pixel art-style image and another in black and white with numbers corresponding to the colors in the palette.

Technology Used

  • Python 3: A powerful and versatile programming language.
  • PIL (Python Imaging Library): An image processing library for Python.

Results

Original image

Image pixelized with color

Blank image pixelized

Conclusion

It was Fun :)

github link : https://github.com/dimaland1/PixelArtGenerator

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (1)

Collapse
 
sreno77 profile image
Scott Reno

You might consider an English translation the the github page

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay