Pixel art scaling algorithms

Pixel art scaling algorithms

Pixel art scaling algorithms are image scaling algorithms specifically designed to upsample (enlarge) low-resolution pixel and line art that contains thin lines, solid areas of colour rather than gradient fills or shading, and has not been anti-aliased.


Two standard scaling algorithms are bilinear and bicubic interpolation. Since they work by interpolating pixel colour values, and usually set each pixel to a value interpolated between four input pixel values, they introduce some blur into the output (a form of box blur). Although this is acceptable for continuous-tone images, it destroys contrast (sharp edges) and is often seen as ruining the appearance of line art.

Nearest neighbour interpolation preserves these sharp edges, but it introduces jaggies (aliasing that makes diagonal lines and curves look blocky). Thus, the ideal algorithm for enlarging line art would be one that would interpolate areas of continuous tone, preserve the sharpness of orthogonal lines and smooth (ideally with anti-aliasing) diagonal lines and curves. Several attempts have been made to accomplish this.


Since a typical application of this technology is improving the appearance of fourth-generation and earlier video games on arcade and console emulators, many are designed to run in real time for sufficiently small input images.

Many work only on specific scale factors: 2x is the most common, with 3x and 4x also present.



Eagle is a library that generically enhances (scales) images, primarily pixel art from old games; the desired result being to make scaled pixel art less "jagged" and "blocky".

Eagle accomplished this as follows: for every in pixel we will generate 4 out pixels, first, set all 4 to the colour of the in pixel we are currently scaling (like nearest neighbor), next lets look at the pixels up and to the left, if they are the same colour as each other set the top right most pixel to that colour, continue doing the same for all four pixels, and then move to the next one [ [http://everything2.com/index.pl?node_id=1859453 Eagle (idea)@Everything2.com] ] .

Assume an in-matrix of 3x3 pixels where the center most pixel is the "current" pixel to be scaled, and an out matrix of 2x2 pixels (that is "this pixel after scaling")

first: |Then . . . -- CC |S T U -- 1 2. C . --/ CC |V C W --/ 3 4. . . |X Y Z
IF V=S=T => 1=S
IF T=U=W => 2=U
IF V=X=Y => 3=X
IF W=Z=Y => 4=Z
Thus if we have a black pixel on a white background it will vanish. This is a bug in the Eagle algorithm, but is solved by its successors such as 2xSaI and HQ3x.


2xSaI, short for 2x Scale and Interpolation engine, is a digital image processing algorithm for computer graphics. It doubles the images both horizontally and vertically, resulting in a new image with four times as many pixels as the original one. The additional pixels are generated by detecting patterns such as lines and edges and interpolating additional pixels on that basis using techniques such as anti-aliasing and Wu lines.

The 2xSaI algorithm was inspired by Eagle. It was designed by Derek Liauw Kie Fa, also known as Kreed, primarily for use in console and computer emulators, and it has remained fairly popular in this niche. Many of the most popular emulators, including ZSNES and VisualBoyAdvance, offer this scaling algorithm as a feature.

Since Kreed released the source code under the GNU General Public License, it is freely available to anyone wishing to utilize it in a project released under that license. Developers wishing to use it in a non-GPL project would be required to rewrite the algorithm without using any of Kreed's existing code.

uper 2xSaI and Super Eagle

Several slightly different versions of the scaling algorithm are available, and these are often referred to as "Super 2xSaI", "2xSaI", and "Super Eagle".

Super Eagle which is also written by Kreed, is similar to the 2XSaI engine, but does more blending.

Super 2xSaI which is also written by Kreed is a filter which smoothes the graphics, but it blends more than the Super Eagle engine.

hq"n"x family

Maxim Stepin's hq2x, hq3x and hq4x are for scale factors of 2:1, 3:1 and 4:1 respectively. Each works by comparing the colour value of each pixel to those of its eight immediate neighbours, marking the neighbours as close or distant, and using a pregenerated lookup table to find the proper proportion of input pixels' values for each of the 4, 9 or 16 corresponding output pixels. The hq3x family will perfectly smooth any diagonal line whose slope is ±1:2, ±1:1 or ±2:1 and which is not anti-aliased in the input; one with any other slope will alternate between two slopes in the output. It will also smooth very tight curves. Unlike 2xSaI, it anti-aliases the output. [ cite web | last = Stepin | first = Maxim | url = http://www.hiend3d.com/hq3x.html | title = hq3x Magnification Filter | accessdate = 2007-07-03 ]

nearest neighbor interpolation]

hq"n"x was initially created for the Super Nintendo emulator ZSNES.


Several similar interpolating graphics engines exist today. These include the open source family of Scale2x, Scale3x and Scale4x technologies (also referred to as AdvMame2x, AdvMame3x or AdvMame4x) developed in 2001 for use in the AdvanceMAME emulator.

Applications to arcade and console emulators

On sufficiently fast hardware, these algorithms allow resizing suitable for real-time applications such as games. These highly optimized algorithms provide sharp, crisp graphics while minimizing blur. Scaling art algorithms have been implemented in a wide range of emulators, 2D game engines and game engine recreations, for example in AdvanceMAME, DOSBox and ScummVM. They have gained wide recognition with gamers, with whom these technologies have encouraged a revival of the gaming experiences of the '80s and '90s.


External links

* [http://bob.allegronetwork.com/projects.html Updated version of 2xSaI algorithm with 32bpp support]
* [http://scale2x.sourceforge.net/index.html Scale2x homepage]
* [http://www.hiend3d.com/hq3x.html hq3x project] (Windows utilities available)

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Pixel art — is a form of digital art, created through the use of raster graphics software, where images are edited on the pixel level. Graphics in most old (or relatively limited) computer and video games, graphing calculator games, and many mobile phone… …   Wikipedia

  • Pixel artist — A pixel artist is a graphic designer who specializes in computer art and can refer to a number of artistic and professional disciplines which focus on visual communication and presentation.cite web last = Stacey first =Patrick coauthors = Andrew… …   Wikipedia

  • Pixel — This article is about the picture element. For other uses, see Pixel (disambiguation). This example shows an image with a portion greatly enlarged, in which the individual pixels are rendered as little squares and can easily be seen …   Wikipedia

  • Image scaling — In computer graphics, image scaling is the process of resizing a digital image. Scaling is a non trivial process that involves a trade off between efficiency, smoothness and sharpness. As the size of an image is increased, so the pixels which… …   Wikipedia

  • Clip art — Examples of computer clip art. (Source: Open Clip Art Library) Clip art, in the graphic arts, refers to pre made images used to illustrate any medium. Today, clip art is used extensively in both personal and commercial projects, ranging from home …   Wikipedia

  • Rasterisation — Rasterization or Rasterisation is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (pixels or dots) for output on a video display or printer, or for storage in a bitmap file… …   Wikipedia

  • Color balance — This article is about the process applied to still images. For the equivalent process applied to video, see Color grading. The left half shows the photo as it came from the digital camera. The right half shows the photo adjusted to make a gray… …   Wikipedia

  • Fractal compression — is a lossy image compression method using fractals to achieve high levels of compression. The method is best suited for photographs of natural scenes (trees, mountains, ferns, clouds). The fractal compression technique relies on the fact that in… …   Wikipedia

  • JPEG — For other uses, see JPEG (disambiguation). Joint Photographic Experts Group A photo of a cat compressed with successively more lossy compression ratios from right to left Filename extension .jpg …   Wikipedia

  • Image editing — For the uses, cultural impact, and ethical concerns of image editing, see Photo manipulation. For the process of culling and archiving images, see Digital asset management. A colorized version of originally black and white photo, colorized using… …   Wikipedia