Skip navigation
Currently Being Moderated

Why can't Photoshop resize images correctly?

Nov 24, 2012 10:23 PM

Tags: #incorrect #resize #enlarge

This seems like a pretty basic function, but my copy of Photoshop can't do it right. Specifically, I'm using CS4, but I have a feeling that doesn't matter. I'd appreciate it if someone else would check to see if their copy of Photoshop works correctly either. Here's some quick step-by-step instructions to try it out:

 

Step 1 - Create a new file that is 4 pixels wide by 4 pixels tall. (Use basic options: 72 pixels/inch, RGB Color, Square Pixels, etc.)

 

Step 2 - Using the pencil tool, draw a red dot (1 pixel wide/tall) in each corner. So that the image looks like this: four_by_four_image.png

 

Step 3 - In the menu, go to "Image" > "Image Size..." and increase the width and height of the image to 400 pixels using "Nearest Neighbor".

 

Now here's the image I end up with:

four_hundred_image.png

So we started with a 4x4 image, and now we have a 400x400 image. The math here isn't too difficult: 4 x 100 = 400. So each of our red dots in the corners should now be 100x100 pixels each. Simple enough, right?

 

Unfortunately, this was not the case for me. The red dot in the upper-left corner is now 97x97 pixels. The red dot in the upper-right corner is now 103x97 pixels. The red dot in the lower-left corner is now 97x103 pixels. And the red dot in the lower-right corner is now 103x103 pixels.

 

I guess Photoshop seems to think that both of the following statements are simultaneously true:

1 x 100 = 97

1 x 100 = 103

 

Am I alone in experiencing this buggy behavior? Or does everyone else get the same result? Is there some way to fix it?

 

Thanks for giving it a try!

 
Replies
  • Currently Being Moderated
    Nov 25, 2012 1:07 AM   in reply to GravyPicante

    pixels/inch

     

    DPI matters... PS's resampling always figures in this stuff. Also check your pref for point/ pica handling. It's a simple precision/ quantization issue due to the math involved.

     

    Mylenium

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 1:25 AM   in reply to GravyPicante

    I get like results in CS6; spreading the canvas by 2px in each direction prior to upsizing will result in the squares being 100px by 100px – but their position on the canvas is 3px off compared to what one might expect.

    So it seems this is limited to edge pixels (background layer or not) – curious indeed.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 3:44 AM   in reply to GravyPicante

    Can't say i ever really noticed that, but it's interesting if you put the 1px squares on separate layers, then it seems to resize right using Nearest Neighbor.

    (right in the way we seem to think it should)

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 4:10 AM   in reply to R_Kelly

    The effect seems to afflict the side where the layer »touches« both (edited) opposite edges, so two squares in a Layer at the top and bottom of the image will result in the expected widths, but not heights and vice versa.

    Edit: Sorry, the observation was not astute – not the distance from an image’s edges seem to be the issue, but whether a side is just one pixel wide or high.

     
    |
    Mark as:
  • Noel Carboni
    23,526 posts
    Dec 23, 2006
    Currently Being Moderated
    Nov 25, 2012 4:07 AM   in reply to GravyPicante

    I can confirm the problem here on Photoshop CS6 Extended x64 using Windows 7.

     

    Adobe has never placed too much emphasis on getting things pixel-perfect in Photoshop - it is more fuzzy and touchy-feely philosophically.  This is not only illustrated by the problem noted above, but also by things like a selection made by a selection tool is often off by a pixel this way or that, paths snapped to things still don't *quite* overlap, etc.

     

    They seem unwilling to change things that have been in the product a while, because apparently when they do so they inadvertently break other things.  And I can't say I blame them...  Given the apparent size of the code base and the extreme age of the software, I wonder what the development cost would be In order to fix something like this across the board, so that every operation really is pixel-perfect.  It might be the kind of thing that a complete redesign from the ground up is needed to fix.  Even then I guarantee you there would be problems.

     

    To Adobe's defense, having been through the development of graphics software myself, I can authoritatively state that actually getting everything pixel-perfect is quite challenging in a world where computing can be done with integers or floating point numbers of various precisions, where no one can quite agree whether a pixel's coordinate identifies its center or one of the corners, where coordinate systems change depending on what subsystem you're using, and where OpenGL documentation recommends you offset your pixels by (0.375, 0.375) in order to ensure they align properly (no kidding).

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 4:34 AM   in reply to GravyPicante

    I tried all the way back to photoshop 3.05 and got the same results, so at least it's consistent between versions.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 6:07 AM   in reply to GravyPicante

    When I scaled it first to 40 and then to 400 it worked. In the past I've noticed similar rounding errors using Illustrator and used scaling in smaller increments as a workaround.

    I don't know much about internal calculation and my guess might be completely wrong but from what I vaguely remember about file formats is that they all use compressions which is more  aggressive with calculations related to images where small truncation errors will not cause big social problems.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 6:29 AM   in reply to emil emil

    Thanks for the excellent test, emil.

     

    foursquares-100.png

    Resolution here 10 Pixels/cm 

     

    Best regards --Gernot Hoffmann

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 7:34 AM   in reply to GravyPicante

    The same errors occur when scaling a layer with NN interpolation, but something interesting can be seen.

     

    When in transform mode, the displayed result is correct for a 10,000% or 1,000% scale. Only when the transform is commited, do the errors appear in the result.

     

    However, in transform mode, the displayed result is wrong for a 1,100% scale. Only when the transform is commited, does the correct result appear.

     

    Note that very inexpensive software is capable of producing the correct result from NN interpolation, unsurprisingly.

     
    |
    Mark as:
  • Noel Carboni
    23,526 posts
    Dec 23, 2006
    Currently Being Moderated
    Nov 25, 2012 8:12 AM   in reply to emil emil

    There a similar inaccuracy when enlarging a 40 x 40 pixel image to, say, 4000 x 4000 pixels.

     

    The inaccuracy seems to be in the vicinity of 102.73% no matter what the sizing.  The 10x increase in size truncates the 10.2x size change to 10, but this would not a good workaround at larger sizes.

     

    For example, a 2 x 2 checkerboard image enlarged 10000 times using Nearest Neighbor will yield size increases of the individual pixels to 9727 pixels square (upper-left) and 10273 pixels square (lower-right).

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 8:49 AM   in reply to Noel Carboni

    The inaccuracy seems to be in the vicinity of 102.73% no matter what the sizing

    Yes, that's what I meant. The workaround is to increase the scale multiple times in smaller increments than all at once.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 9:28 AM   in reply to emil emil

    If you look at it from just an engineering standpoint you will see that the accuracy of the scaling is within 3%.  For most devices and systems that is considered very accurate.  Like emil emil showed the 3% rounding error does not show up at 10% but is obvious at 100% enlargement.

     

    In laymans terms 1 pixel can be read as 0.97 to 1.03.  For this not to be a noticable the accuracy would have to be increased by a factor of 10 so 1 pixel would be 0.997 to 1.003.  Does anyone care?  High precision instruments cost goes exponential with more accuracy.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 10:37 AM   in reply to Curt Y

    Curt Y wrote:

     

    High precision instruments cost goes exponential with more accuracy.

     

    We're talking about scaling up a raster image (finite discrete pixels) by an integer factor, and using the simplest interpolation method, namely Nearest Neighbour.

     

    Like I posted above, software that costs peanuts is available which can do Nearest Neighbour interpolation correctly. There will be free software, too, I expect.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 11:06 AM   in reply to conroy

    Should the Adobe engineers expect that some idiot expert would

    really want to upsample a raster image by factor 10 or 100 in

    professional image processing applications?

     

    Best regards --Gernot Hoffmann

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 11:15 AM   in reply to Gernot Hoffmann

    Gernot Hoffmann wrote:

     

    Should the Adobe engineers expect that some idiot expert would

    really want to upsample a raster image by factor 10 or 100 in

    professional image processing applications?

     

    Best regards --Gernot Hoffmann

     

    Is a professional really interested in an idiot's opinion?

     

    Best regards

     
    |
    Mark as:
  • Noel Carboni
    23,526 posts
    Dec 23, 2006
    Currently Being Moderated
    Nov 25, 2012 12:15 PM   in reply to Gernot Hoffmann

    Gernot, I think you may be picking up on a trivial aspect of the problem, and perhaps missing the big picture (sorry for the pun ).

     

    The implication is that everything's offset by a little over 2% toward the upper-left after a resampling operation.

     

    I don't know about you, but I like my Photoshop results to be pixel-perfect, not 2% off.  Digital systems can actually do that.  Conroy's right, IrfanView  - free PC software - can upsample such an image perfectly.

     

    Haven't you ever needed a perfect digital upsample of something tiny (e.g., an icon)?

     

    I'm having trouble understanding why anyone would imply that this behavior is okay to just leave as is, now that it's been exposed, in THE premium priced graphics editor on the planet. 

     

    Who knows how many of our images could have been 2% better without this error?

     

    -Noel

     
    |
    Mark as:
  • JJMack
    6,017 posts
    Jan 9, 2006
    Currently Being Moderated
    Nov 25, 2012 2:56 PM   in reply to GravyPicante

    When you report problems to Adobe even if Adobe acknowledges the problem is a programming errors they evaluate what they impact the bug has.  Many bugs seem to get classify by Adobe as having little impact and Adobe defers fixing these bug till some future release of Photoshop. Adobe doesn't specify which future release so I fear many bugs will go un-fixed forever.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2012 11:20 PM   in reply to GravyPicante

    Robbing people blind is okay, assuming that you are selling a really awesome piece of software. Unfortunately, Adobe is more interested in your wallet than they are in the quality of their own product. They are essentially selling us the same copy of PS from 1988 in a new package.

    While Adobe management probably cares little about the quality of their product as long as it makes money (and promises to continue doing so) I guess it is safe to assume that the programmers of Photoshop have an actual interest in providing a good program – after all who would want to be associated with bad products?

    And if you fail to perceive the changes and improvements that have been introduced to Photoshop since 1988 then maybe you didn’t know Photoshop 1.

     

    But I’m not contesting that the issue at hand should be addressed.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points