Author Topic: Image scaling/resize quality  (Read 16826 times)

0 Members and 1 Guest are viewing this topic.

Offline Hyomil

  • User
  • ***
  • Posts: 96
    • View Profile
Image scaling/resize quality
« on: May 05, 2010, 09:27:15 am »
When I switch to PVD to view large posters after seeing them in Firefox, I'm struck by how much softer/blurrier they are.  I've written this off to a faster algorithm being needed for real-time scaling like occurs when dragging, but as computers have gotten faster, maybe something better could be used, at least as an option.  Photoshop includes Nearest Neighbor, Bilinear, and Bicubic algorithms.  Even Bicubic executes instantly on my computer for a 899x1280 image.  And even Bilinear looks better than whatever algorithm PVD is using.  Attached is a PrintScreen cap with a poster resized in Photoshop using Bicubic on the left and a screencap of it scaled to the same size in PVD on the right.  The black text at the top is shows the difference most clearly.



[attachment deleted by admin]
« Last Edit: May 05, 2010, 07:19:46 pm by Hyomil »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Image scaling/resize quality
« Reply #1 on: May 05, 2010, 11:52:56 am »
Sorry, I don't understand. I find it very difficult to tell the difference. In the attached, I can see the lettering at the top is noticeably different—at full size. But the PVD version looks better!

[attachment deleted by admin]

buah

  • Guest
Re: Image scaling/resize quality
« Reply #2 on: May 05, 2010, 11:54:52 am »
And for whom is this thumb down? ;)

I'm kidding, of course, just couldn't stand not to notice...
« Last Edit: May 05, 2010, 12:58:36 pm by buah »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Image scaling/resize quality
« Reply #3 on: May 05, 2010, 12:42:43 pm »
Blurry or not, I took it as fair warning to all who might be so foolish as to consider watching it.

mgpw4me@yahoo.com

  • Guest
Re: Image scaling/resize quality
« Reply #4 on: May 05, 2010, 03:13:28 pm »
I suspect this is related to the image quality (compression level) set as an option when saving a JPEG image.  BMP and GIF are much clearer.  Anything lower than 80% results in significant blurring and artifacts in the saved image...given my eyesight...your results may vary if you wear glasses with thinner / thicker lenses than I do.   ;)  Of course, the higher the quality, the more space it takes in the database...

A user setting to control JPG image quality would seem a simple fix.
« Last Edit: May 05, 2010, 03:16:18 pm by mgpw4me@yahoo.com »

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Image scaling/resize quality
« Reply #5 on: May 05, 2010, 05:47:17 pm »
Quote
A user setting to control JPG image quality would seem a simple fix.

all images are saved as they are without converting to jpg or changing the compression level.
Gentlemen, you can’t fight in here! This is the War Room!

Offline Hyomil

  • User
  • ***
  • Posts: 96
    • View Profile
Re: Image scaling/resize quality
« Reply #6 on: May 05, 2010, 08:35:21 pm »
Sorry, I don't understand. I find it very difficult to tell the difference. In the attached, I can see the lettering at the top is noticeably different—at full size. But the PVD version looks better!

Just to make sure, you understood that the PVD version is the one on the right--not the one on the left? ;)  Since I saw the difference even in the PNG PrintScreen cap as well as when using PVD, I thought it couldn't be something wrong with my system.  And I still see the sharpness difference clearly even in your JPG, although that has more pixelation/noise than my PNG did, which I presume is a result of the JPEG compression and would make the 'smoothness' of the PVD version appear 'better.'  If that noise is not from the JPEG compression and you see it even in the uncompressed version of that image, I'm at a loss to explain it unless its a byproduct of the program you did the resizing with.

But maybe it could be due to a difference between an LCD monitor and a CRT like the one I'm using, as I know fonts that look good on one can look bad on the other (ex. ClearType), although I thought the difference with photos was minimal.  Is everyone else using an LCD?  (I still prefer CRTs over LCDs or plasmas, as AFAIK only OLEDs or micromirror projectors can match/better their response times.)

Another thing I thought of, assuming the difference is in the way PVD scales the image vs. my display, is that some kind of deliberate noise reduction has been incorporated into the algorithm which might make poor-quality images look better when enlarged but high-quality images look worse when reduced.  (Photoshop has a different algorithm for enlarging images than it does for reducing them--Bicubic Smoother vs. Bicubic Sharper, respectively.)

And for whom is this thumb down? ;)

I'm kidding, of course, just couldn't stand not to notice...

In my mind, it was thumbs down for having to crop the image to fit the 512K attachment size limit of the forum.  The full PrintScreen image was 1280x960 and too big when compressed using the lossless PNG format, which I needed in this case.  And thumbs down to the movie too--I saved the poster as a reminder not to watch, lest I should forget.   ;D
« Last Edit: May 05, 2010, 09:29:10 pm by Hyomil »

buah

  • Guest
Re: Image scaling/resize quality
« Reply #7 on: May 05, 2010, 08:51:26 pm »
My thoughts what could be the reasons for (not) seeing differences:
- Different types of monitors we're using
- Different resolutions we're using
- Differences in (default) image viewers themselves - like video players: different picture frame quality with different players.

Offline Hyomil

  • User
  • ***
  • Posts: 96
    • View Profile
Re: Image scaling/resize quality
« Reply #8 on: May 05, 2010, 09:23:28 pm »
My thoughts what could be the reasons for (not) seeing differences:
- Different types of monitors we're using
- Different resolutions we're using

Yes, LCD monitors have a native resolution (like 1280x1024) and if you use any resolution other than that, the picture will be significantly less sharp.  CRTs don't have that problem, and I tested mine by viewing the image at different resolutions.  If you have an LCD, I would think you'd want to be using its native resolution, although I don't have any personal experience with it.

Quote
- Differences in (default) image viewers themselves - like video players: different picture frame quality with different players.

(For those who aren't aware, you can view forum image attachments in your browser by clicking on the image thumbnail rather than downloading it by clicking on the attachment name.)

Differences in scaling algorithms between image viewers, yes, but you'd want to view the image at full/actual size and there should be little, if any, difference there.  I checked the images in Photoshop, FastStone MaxView, and MS Paint with identical results.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Image scaling/resize quality
« Reply #9 on: May 06, 2010, 12:49:00 am »
Quote
And I still see the sharpness difference clearly even in your JPG, although that has more pixelation/noise than my PNG did, which I presume is a result of the JPEG compression and would make the 'smoothness' of the PVD version appear 'better.'

I did have to use JPG (at 95%, I believe) to get it less than 512k. I thought it still conveyed the same difference I saw in the originals. Those too, were resized a little to display at the same size in the two different viewers. I use an LCD at native resolution. But whatever you call the affect and regardless of what causes it, I still wonder what difference it makes. This just shows how subjective this is. I happen to think the image you believe is somehow "degraded" looks "better" than the original. Had my attention not been directed to making the comparison, I would never notice the difference.

So the question is, considering PVD is not Photoshop, is there some issue with how it's handling images? I don't know how these things work, but I would assume the requirement is so common these things are handled in an acceptable manner by standard tools—that don't require the programmer to be an imagining expert. Is my assumption incorrect? If not, maybe some research on available tools and the best way to implement them would be helpful. :-\

mgpw4me@yahoo.com

  • Guest
Re: Image scaling/resize quality
« Reply #10 on: May 06, 2010, 01:09:18 am »
The issue is more obvious with people images than posters.

Here I go with assumptions (again) since I can only guess at the code being used.  If the Delphi image control is being used, and the stretch property is set TRUE, I'd assume (ugh) the StretchBlt Windows function is being used for image scaling.  This is a 'fast & dirty' scaling function that I've seen in action myself, with the same results as PVD...not 'special'.

My solution was to write a matrix scaling routine, but in real time, this would not be reasonable.  Further research turned up this C++ code:
http://www.ucancode.net/faq/Draw-Image-StretchBlt-Dib-VC.htm



[attachment deleted by admin]

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: Image scaling/resize quality
« Reply #11 on: May 06, 2010, 10:04:21 pm »
I use the Graphics32 components and I do have many different algorithms for resizing images. I thought I have chosen the one with the best quality/speed... I could make some tests and pick the sharper one when I have nothing else to do.
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Image scaling/resize quality
« Reply #12 on: May 07, 2010, 08:08:27 am »
Here I go with assumptions (again)...

That control turned my image into a newt! ;D

mgpw4me@yahoo.com

  • Guest
Re: Image scaling/resize quality
« Reply #13 on: May 07, 2010, 03:00:41 pm »
Any image scaling that involves averaging will cause blurring, while anything that selects the 'closest color' will create aliasing (the 'step effect' you get on diagonal lines), so I don't doubt the 'best' algorithm is already being used, given that the best method will change based on the image being scaled.  Blurring is less noticeable than jagged edges.

A light sharpen on images that are downsized (and not others) might be a better use of time than hunting for a better scaling method.

Offline Hyomil

  • User
  • ***
  • Posts: 96
    • View Profile
Re: Image scaling/resize quality
« Reply #14 on: May 07, 2010, 05:53:17 pm »
A light sharpen on images that are downsized (and not others) might be a better use of time than hunting for a better scaling method.

I'm familiar with the general advice to lightly sharpen images after resizing them, but I often don't take the trouble to do it since the difference is so slight when using the more computationally intensive algorithms like Bicubic or Lanczos.  With the PrintScreen cap from PVD, though, using an Unsharp Mask filter on it really made it virtually indistinguishable from the version that was resized with Bicubic in Photoshop.  Maybe that would be a good solution if it didn't slow things down too much for users with slower computers.  Original image I posted is attached with the Bicubic resize still on the left but the PVD cap on the right sharpened with Unsharp Mask (Amount 44%, Radius 1.0).  (It actually looks minutely better now than the Bicubic version, but if you gave that version an appropriate amount of sharpening, I'm sure they'd be the same.)

[attachment deleted by admin]