Skip to main content
Adobe Photoshop Family

37 Messages


738 Points

Fri, Oct 25, 2019 3:00 PM

Photoshop transform scale float precision bug

There is an error in the displayed pixel size while using free transform on a smart object.
Demo PSD

Steps to reproduce:
  1. Create shape rectangle 700*700px
  2. Make sure that it is on the rounded X,Y coordinates by entering Free Transform mode. (Ctrl/Cmd+T)
  3. Exit from Free Transform mode
  4. Convert rectangle to Smart Object
  5. Enter Free Transform mode again
  6. Switch the reference point to the top-left corner
  7. Right-click on the width and select Pixels, then do the same for height but set it to percents. We do this only to watch the bug - it doe not influence anything.
  8. Make sure that "Maintain Aspect Ratio" is ON
  9. Set the width to 100px
  10. Click on the height input field
  11. Now you see that instead of 100px you will have 100.03px in the width field.
Why this is happening?

This happens because as you see it's scaled by 14.29% which results in 100.3px.
700 * 0.1429 = 100.3
That means that rounding happens before the actual transform is applied or displayed (i hope its a UI error only)
100 / 700 = 0.1428571428571429 = 14.28571428571429%
700 * 14.28571428571429% = 100px

Why it is important?
There are NUMEROUS errors that can happen because of this float rounding/precision error.
  1. When you export images via Adobe Generator or regular export.
  2. When you set Snap Vector tools to pixel grid in the settings but the resulting scale is NOT snapped.
  3. When you resize raster imagery.




626 Messages


14.6K Points

a year ago

I have also had issues with the way transform converts to percent in the background (in scripts, too) and only to two decimals.