Sign in to follow this  
xrl

LCD Subsampling resize using SubLCD algorithm

Recommended Posts

I was bored and I decided to try doing a filter for fun, so I coded a little resize plugin based on the SubLCD algorithm by Kim Øyhus. This is also the first time I try coding a plug in... Not that I spent much time with it.

It's useful if you want to display your images in a LCD/Plasma screen as it gives the apearence of a little more resolution. It's what's used to render fonts nowadays.

For more information check: http://oyhus.no/SubLCD.html

Now following with some samples (normal resize on the left, SubLCD on the right):

s0.pngs1.png

Some lines generated with some Paint.net line generator plugin...

t0.pngt1.png

Text!

l0.pngl1.png

A logo... notice the sleeves, look much sharper with SubLCD.

b0.pngb1.png

A colour picture where it's "easy" to spot difference: look at the details in the helmet, and the holes.

All pictures should at least look sharper on a LCD screen.

Download it here: http://web.ist.utl.pt/tcf/rand/sublcd/sublcd.zip

BTW: You should crop half of the image after using the plugin. I didn't bore to see how it's done. :oops:

The source, I used CodeLab, is in the zip. Enjoy.

sublcd.zip

Share this post


Link to post
Share on other sites
Does it only resize horizontally? If so, would you be able to have the code increase the image width by 200% and then apply the effect?

The algorithm only resizes by half in the horizontal direction. Try reading in the page and understanding what it does and why.

You should resize the image normally to the desired width*2 and height, then apply the filter, and then crop it to width x height.

Share this post


Link to post
Share on other sites

Very interesting plug-in, this certainly has potential. However i am not 100% clear on what i should be doing. If you could provide some simple pointers on how to use SubLCD and what you would use it for, this would clear up my understanding a lot. Apart from that very good effort for a fist go at coding :D , and i'm sure it will come in handy when resizing pics once people have a better understanding.

Geoff

Share this post


Link to post
Share on other sites
Very interesting plug-in, this certainly has potential. However i am not 100% clear on what i should be doing. If you could provide some simple pointers on how to use SubLCD and what you would use it for, this would clear up my understanding a lot. Apart from that very good effort for a fist go at coding :D , and i'm sure it will come in handy when resizing pics once people have a better understanding.

Geoff

It resizes your your image horizontally at 50% while retaining the sharpness. For this to work you need to start by resizing your image so that the height (vertical dimension) is half that of the original image. Then run the plugin.

Share this post


Link to post
Share on other sites
xrl, I see how it works. The effect's output is very nice. However, due to the excessive set up, this isn't something that I'll use often.

It's not that excessive... all you need to do is crop it... and resize it vertically before :D

However i am not 100% clear on what i should be doing. If you could provide some simple pointers on how to use SubLCD and what you would use it for, this would clear up my understanding a lot.

I have to say that I don't really know what can you use it for... It can give you some extra detail in very small screens, like phones and portable consoles (wallpapers, images with a fixed size). The the difference between this and a normal resize isn't that big, so you should save the files in a lossless format (.png).

I may update the plugin to crop after resizing, or maybe someone could do it for me (the code is in the zip) :P

Share this post


Link to post
Share on other sites

Looks to me like this works in a similar manner to ClearType, in which case, while this is great for LCD monitors, when the images are viewed on non-LCDs, the picture quality will be dramatically worse than before. That's not really a big deal, though, considering how LCDs are quickly taking over the market.

Share this post


Link to post
Share on other sites
I have to say that I don't really know what can you use it for... It can give you some extra detail in very small screens, like phones and portable consoles
...Or any time your images size is limited (e.g., avatars, favicons or program icons, etc.).

Share this post


Link to post
Share on other sites

Ok, short explanation how this stuff works: the plugin attempts to perform ClearType on arbitrary images effectively. This basically means that the physical ordering of the red, blue and green subpixels on an LCD screen is utilized by antialiasing with colored pixels.

Since the subpixels are usually ordered horizontally in R-G-B order (on most screens; some use B-G-R and then this plugin will yield pretty blurry images) you can take advantage of that and effectively triple the horizontal resolution (not exactly, there are some things that prevent you from doing so). What this algorithm does, according to its website is combining the red and blue pixels into one. This is, however, not how subpixel antialiasing works usually. You can see that the results are inferior to ClearType or similar methods by the color fringes it produces, especially in the first and third example pictures. (Also what the author states, that the perceived brightness of red and blue together is about the same as green alone is a bit away from the truth. Perception levels are (in RGB order): 30, 59, 11)

What ClearType does, is not simply distributing the pixels directly on the available colored subpixels but rather distributing the available energy on adjacent pixels as well. This does indeed make the image more blurry but has the distinct advantage that we perceive it as crisp as before and we don't have the color fringes the other method produces. Also, usually you start out with an image of tripled width, since there are three subpixels :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this