Google-apps
Hoofdmenu

Post a Comment On: C0DE517E

"Photoshop scripting - Cleartype for images"

13 Comments -

1 – 13 of 13
Anonymous Preshing said...

Nice. Now make it gamma correct :)

November 25, 2011 at 2:23 PM

Anonymous Preshing said...

Seriously though, nice idea. One wonders if it would ever catch on for graphics hardware.

November 25, 2011 at 2:34 PM

Anonymous Royi said...

Could you describe it in Pseudo Code or any other way some one who doesn't how to script in Photoshop could understand the algorithm?

Thanks.

November 25, 2011 at 2:47 PM

Blogger DEADC0DE said...

Preshing: I did, but the result seemed to be identical, so maybe photoshop is doing resize in gamma. Not 100% sure

November 25, 2011 at 2:55 PM

Blogger DEADC0DE said...

Royi: it's really simple, I first resize to 1/3 vertically, then horizontally instead of resizing I take the red channel from the first pixel each three, the green from the second and the blue from the third. The idea is that the RGB elements in a LCD appear packed in this order, side to side, so packing this way three columns into one you kinda get a bit more resolution. The way it's done in photoshop scripting is to create three copies of the image after the vertical resize, shift each one and then do a "nearest neighbor" 1/3 horizontal resize (that will just take the second pixel each three), then making the three layers red, green and blue and merging everything together.

November 25, 2011 at 2:58 PM

Blogger DEADC0DE said...

Royi: a lot of color fringing will appear on high-frequency details this way though, so I do a bit of gaussian blur (lowpass filter) before starting this process.

November 25, 2011 at 2:59 PM

Blogger DEADC0DE said...

Preshing: I was wrong, it's hard to see its influence on most images but photoshop does not resize in linear, I've fixed this in the script, even if it's quite convoluted

November 25, 2011 at 5:13 PM

Anonymous Rim said...

@DEADC0DE: I've done a quick and dirty implementation in C# and I can't seem to replicate your fringing artifacts. The rendering actually seems to work out best for images with high-frequency details (for example), or am I misinterpreting high-frequency?

November 28, 2011 at 4:55 AM

Blogger DEADC0DE said...

Rim: yes, you have to have a source image with quite some detail, otherwise you won't notice any difference. On the other hand, if you get too much frequency you'll get fringing for sure. Imagine a 1-pixel black-on-white line in the source image... without pre-filtering, it will get "translated" into a fully red, green or blue line in the cleartype image, which is obviously a severe colour shift that is not acceptable. That's why pre-filtering is useful.

November 28, 2011 at 11:52 AM

Blogger DEADC0DE said...

Rim: Notice in fact that in my implementation, you don't really get sharper images, you get smoother edges. Which is the objective of cleartype also on fonts, hardly a cleartype font is sharper than a non-antialiased black on white one, it's smoother...

November 28, 2011 at 11:57 AM

Anonymous Rim said...

DEADC0DE: I can't help but wonder if sharpnening isn't precisely what happens to the images. You're obviously right on the font end, but there ClearType is geared specifically towards subpixel hinting for smooth display. On images, all we're doing (at least in my implementation) is effectively trippling the horizontal resolution at the cost of color fidelity, which I think can only increase contrast and doesn't result in smoothing.

Either way, to me the processed images really do look sharper and I can't say I notice any color issues (this includes the image at the top of your post). I'm curious as to whether this might differ from person to person?

November 29, 2011 at 5:40 AM

Blogger DEADC0DE said...

Rim: I guess it might be a perception issue but also a given tolerance to some defects, I had different reactions from different persons and the "right" amount of sharpening really is a subjective measure. But surely if you don't bandlmit you will have fringes on some images. The single pixel black line "test" tells us that

November 29, 2011 at 6:06 PM

Anonymous Rim said...

DEADC0DE: Are you aware of any research done into this type of image rendering, particularly how it's perceived? It'd be interesting to know whether controlled tests show that it's an appealing display method to the majority of users.

As for the bandlimiting, I certainly see you point. Sadly I don't know enough about DSP to discuss this on proper footing. Intuitively though I'd say it's a tradeoff, paying in contrast detail through blurring to reduce aliassing of the final image.

It's an interesting topic at any rate, so thanks for your post & replies.

November 29, 2011 at 8:49 PM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot