Skip to content

RodrigoBrunale/BlackToColors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Colorful Image Transformations 🎨🖼️

Welcome to the wonderful world of image color transformations! This script magically turns those pesky black pixels in your images into an array of delightful colors (or even transparent if you're feeling fancy).

Table of Contents

About the Project

Have you ever looked at an image and thought, "I wish the black in this picture was a pastel blue... or red... or transparent!"? Look no further! This Python script uses the power of FFmpeg to replace black pixels in PNG images with a chosen set of colors or even make them transparent. The script is flexible, user-friendly, and ready for you to experiment with.

Design Choices

  1. Dynamic Image Size Handling: The script now supports images of any resolution, dynamically adjusting to the size of each image for color transformations.

  2. Why FFmpeg? We chose FFmpeg because it's a powerful tool for handling multimedia data. It provides a vast array of capabilities, which made it perfect for our image transformation needs.

  3. Directory Management: To keep things tidy, the script creates directories for each color transformation. Originals are tucked safely in their own folder, ensuring they remain pristine.

  4. Flexibility: We've set up a COLORS dictionary, allowing you to easily add or remove colors as you see fit. This makes customizing the output a breeze.

  5. Dark Pastel Colors: After some deliberation (and some handy feedback), we realized that since we're replacing black, the new colors should be closer to black for the details in the images to pop. So, we went with darker shades which, while being closer to black, still retain a hint of color.

Getting Started

Prerequisites

  • Ensure you have FFmpeg installed. If you haven't, you can get it here.

  • This script is written in Python. Make sure you have Python installed.

  • The script also requires the Pillow package. Install it using pip:

    pip install Pillow

Usage

  1. Place your PNG images in the same directory as the script. Original images will be moved to the originals folder and their transparent versions will be placed in the transparent folder.
  2. Run the script:
    png_black_replacer.py
  3. Watch as directories spring into existence, each containing your images transformed with delightful new colors!
  4. To customize the colors, adjust the COLORS_UPDATED dictionary at the top of the script. You can add new colors, modify existing ones, or comment out any color if you wish to skip it. The folder names for the transformed images will reflect the color name and its hexadecimal code.

Fun Fact

Did you know? The human eye can detect approximately 10 million different colors. With this script, you're one step closer to seeing them all! 🌈

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages