Standard Algorithm
The Standard algorithm is the default pixelation algorithm in Image2pixel. It uses a combination of downsampling and color quantization techniques to produce classic pixel art from any image.
How It Works
The Standard algorithm works in two main steps:
- Downsampling (Pixelation): The original image is divided into blocks of pixels based on the selected Block Size. Each block is then replaced with a single color determined by the average color of all pixels in that block.
- Color Quantization: The algorithm reduces the number of colors in the image to match the selected Color Count using the Median Cut algorithm, ensuring that the most important colors are preserved.
This approach creates the classic pixel art look with uniform, blocky pixels and a limited color palette.
Parameters
Block Size
The Block Size parameter controls the size of each pixel in the output image. Larger values create a more pixelated, blocky look with fewer details, while smaller values preserve more details but create a less distinct pixel art appearance.
Value | Effect | Best For |
---|---|---|
1-4 | Subtle pixelation, high detail preservation | Detailed sprites, complex textures |
5-12 | Moderate pixelation, good balance of detail and pixel art style | Most pixel art, game assets |
13-32 | Strong pixelation, highly stylized appearance | Low-resolution styles, retro effects |
Colors
The Colors parameter determines the maximum number of colors in the output image. This affects the color depth and visual complexity of the pixel art.
Value | Effect | Best For |
---|---|---|
2-8 | Highly limited color palette, high contrast | 1-bit or 3-bit style pixel art, GameBoy-inspired artwork |
9-32 | Moderate color palette, good balance of simplicity and color depth | 16-color console style, SNES-era pixel art |
33-96 | Rich color palette, maintains more color nuance | Detailed pixel art, more modern pixel art styles |
Color Quantization
The Standard algorithm uses Median Cut color quantization to reduce the number of colors in the image. This algorithm works by:
- Creating a 3D histogram of all colors in the image (in RGB color space)
- Recursively splitting the color space along the axis with the largest range until the desired number of color buckets is reached
- Computing the average color for each bucket to create the final color palette
- Mapping each pixel to the closest color in the palette
This approach ensures that the most common and visually important colors in the image are preserved, while similar colors are merged together.
Transparency Support
As of version 1.3.2, the Standard algorithm fully supports transparency in images and GIFs. Transparent pixels in the input are preserved during processing, allowing you to create pixel art with transparent backgrounds or partially transparent elements.
The algorithm detects pixels with an alpha value below 10 (on a scale of 0-255) and treats them as fully transparent, preserving them throughout the pixelation and color quantization process.
Example Usage
Creating Classic Pixel Art Characters
For character sprites and avatars, try these settings:
- Block Size: 8-12
- Colors: 16-24
Creating 8-bit Style Landscapes
For retro-style landscapes and backgrounds:
- Block Size: 6-10
- Colors: 12-20
Creating Minimalist Icons
For simple, recognizable icons:
- Block Size: 4-8
- Colors: 4-8
Comparison with SLIC Algorithm
The Standard algorithm differs from the SLIC algorithm in several key ways:
Feature | Standard Algorithm | SLIC Algorithm |
---|---|---|
Pixel Shape | Uniform, grid-based squares | Irregular, content-aware shapes |
Detail Preservation | Uniform across the image | Adaptive based on image content |
Parameter Complexity | Simple (2 parameters) | More complex (5 parameters) |
Processing Speed | Faster | Slower (especially with higher iteration counts) |
Best For | Classic pixel art, retro game aesthetics | Modern pixel art, stylized abstractions, complex scenes |
Tips for Best Results
- Start with simple images: Images with clear shapes and high contrast tend to produce better pixel art results.
- Experiment with Block Size: The Block Size has the most dramatic effect on the appearance of your pixel art. Try different values to find the right level of detail.
- Adjust Colors based on content: Images with many different colors may need a higher color count to look good, while simpler images can often look better with fewer colors.
- Consider the destination: If your pixel art is for a game or app with specific technical constraints, adjust your settings accordingly.
- Use custom palettes: For more control over the final look, consider using a custom color palette to ensure your pixel art matches a specific aesthetic.
For more advanced customization options, see the Color Palettes documentation.