Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RGB subpixel rendering for graphics?

I wonder if there is any graphics library that supports RGB subpixel rendering (like ClearType) for general graphics, not just for text. This would allow one to practically triple the horizontal resolution, and put graphics on third-pixel x positions.

While I think this would be very useful, I couldn't find much on the internet about it, except the following:

  • How Sub-Pixel Font Rendering Works (there are some line images around the middle)
  • Subpixel rendering and image resizing (some interesting thoughts on applying subpixel rendering to resizing bitmaps)

Is there any library that implements this, or are there efforts to bring something like this to the Cairo library, for example?


Update:

I'm referring specifically to rendering techniques that take into account that current LCD screens use sub-pixels of different colors. To make a white point, you set all sub-pixels to 'on' or 255. A white line would be several subpixels on top of each other:

...RGB...
...RGB...
...RGB...
...RGB...
...RGB...
...111...

(where . is a fully black sub-pixel, and R, G or B are fully-lit red, green, or blue sub-pixels). Because our eyes can't resolve the sub-pixels, they blend together to make a white line. I could however also make a white line from the following:

....GBR..
....GBR..
....GBR..
....GBR..
....GBR..
....111..

Note that it is perfectly sharp, but positioned at x = 1 1/3 pixels. This is not possible with traditional rendering techniques that draw a slightly blurry white line instead. Here for example R=70% lit, r=30% lit. I didn't work out the math, this is just so you get the idea:

...RGBrgb...
...RGBrgb...
...RGBrgb...
...RGBrgb...
...RGBrgb...
...777333...

Another example is a slope, which you can do a) with full pixels, b) antialiased, or c) with subpixel rendering:

a)  RGB......  b)  RGB......  c)  RGB......
    RGB......      RGBrgb...      .GBR.....
    ...RGB...      rgbRGB...      ..BRG....
    ...RGB...      ...RGB...      ...RGB...
    ...RGB...      ...RGBrgb      ....GBR..
    ......RGB      ...rgbRGB      .....BRG.
    ......RGB      ......RGB      ......RGB

Again, note that this is just a crude example to give you the general idea, but you see that a) is jaggy or aliased, b) is blurry, and c) is as sharp as you can get it on a LCD.

Real implementations of this, for font display (ClearType on Windows and the subpixel rendering in FreeType) have a more sophisticated algorithm. They take into account that individual sub-pixels bleed or shine into each other, they preserve the total color intensity or energy. They also take into account that the subpixel spacing is not even (the spacing between R and G, or G and B (in the pixel) may be smaller than between B and R), and finally that some displays have entirely different pixel layouts.

like image 232
jdm Avatar asked Jul 16 '12 15:07

jdm


People also ask

What is subpixel in image processing?

Sub-pixel estimation is the process of estimating the value of a geometric quantity to better than pixel accuracy, even though the data was originally sampled on an integer pixel quantized space. 1 Background.

How do subpixels work?

Subpixel rendering works by increasing the luminance reconstruction points of a color subpixelated screen, such as a liquid crystal display (LCD) or organic light-emitting diode (OLED) display. This thumbnail image is downsized and does not show the technique. Click to see the full-size image.

How many subpixels are in a pixel?

8.5. For color displays, each pixel is made up of three subpixels for red, green and blue. Each subpixel can be set to 256 different shades of its color, so it is therefore possible for a single LCD pixel to display 256 ∗ 256 ∗ 256 = 16.8 million different colors.


2 Answers

As far as I know no graphic library with subpixel RGB rendering exists.

Here are a few possible reasons why :

  • Microsoft has a few patents on RGB subpixel rendering technology. I don't know if those patents applies only to font rasterization but if not, it is probably a very good reason why other graphic libraries do not use it.
  • Like pointed in the question, subpixel rendering is relying on a hardware implementation. It works well with displays that compose color by placing side by side 3 color cells (for instance an LCD monitor). For all other display types (plasma, projectors, old CRT), it doesn't work.
  • Subpixel rendering adds horizontal resolution only. This limitation is not problem for font rasterization since it is often horizontally that font needs more resolution (see bold and italic characters and kerning). With "custom" graphic it would be weird to have different resolution on each axis.
  • Subpixel rendering doesn't work with rotational display. For instance, mobile device have to use both RGB subpixel rendering and antialiasing.
  • Subpixel rendering works only with the native resolution of a display.
  • It looks like color blind people have problem with subpixel rendering. See this paper for more information.
  • Subpixel rendering works very well with black on white or white on black backgrounds. With other backgounds the "renderer" has to know the background color to adjust the subpixel effect. For this very reason Office 2013 stopped using ClearType.
  • This is more subjective but the difference between subpixel rendering and antialiasing is very subtle. The cons and added complexity of subpixel rendering might not be worth it.

IMHO, the future of better graphics is with higher pixel density like the Apple retina display.

like image 133
ForguesR Avatar answered Oct 10 '22 05:10

ForguesR


Someone managed to get some interesting results using ImageMagick. The method and results, as well as an interesting discussion, are exposed here: https://www.imagemagick.org/discourse-server/viewtopic.php?t=19120

Interesting subject, indeed. But the point remains: how useful can the technique be, since such process would only benefit unscaled images on a specific type of display?

like image 36
Bigue Nique Avatar answered Oct 10 '22 05:10

Bigue Nique