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: ![]()
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:
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!
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.
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.
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
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.
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.
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
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.
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.
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
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
@Noel: Thank you for explaining why this error is so important.
Indeed, I was working on a very detailed icon when this bug reared it's ugly head. Had to toss the image because the pixels were off.
Photoshop isn't some piece of software that I bought at Walmart for $30. Adobe wants $1000 for the current version of PS. Oh wait, that's for Photoshop Extended. The regular version of Photoshop CS6 is a bargain at a mere ....errr $700.
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. Photoshop has been around for a quarter of a century, and has seen 18 major revisions during its lifetime. Isn't that long enough to fix a simple rounding error?
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.
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.
North America
Europe, Middle East and Africa
Asia Pacific