Bug 442124

Summary: Resizing an image by % results in the wrong size
Product: [Applications] krita Reporter: Earendel <earendel>
Component: Resize/Scale Image/LayerAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR Keywords: triaged
Version: 4.4.5   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Earendel 2021-09-07 12:59:09 UTC
When using Scale To New Size the result can be the wrong size.

STEPS TO REPRODUCE
Make an image of size 5632px wide by 7808px tall.
Scale To New Size: Width 50.00%, Height 50.00%

OBSERVED RESULT
2815px wide by 3904px tall.


EXPECTED RESULT
2816px wide by 3904px tall.


SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
It is not affected by constrain proportions.
Selecting 50%/50%, then switching to px mode in the resize dialogue does auto-populate the correct output dimensions but leaving it in % mode does not give the correct output. 

The correct size of image is important when working with game engines that expect images of exact sizes.
Comment 1 Lynx3d 2021-09-08 20:41:58 UTC
Git commit b058b377aff035d156e13996b4ffa6f29a5bda9f by Mathias Wein.
Committed on 08/09/2021 at 20:41.
Pushed by mwein into branch 'master'.

Fix imprecise dimensions when using image size dialog

Due to the way multiple units are handled, the result can be a tiny bit
smaller then the true value of e.g. 50% of 2816 px, despite qreal precision.
Furthermore, the spinbox will round to nearest integer when you
switch back to pixels, so the final value should consistently be rounded
instead of truncated for non-pixel input units.

M  +2    -2    libs/ui/imagesize/dlg_imagesize.cc

https://invent.kde.org/graphics/krita/commit/b058b377aff035d156e13996b4ffa6f29a5bda9f
Comment 2 Lynx3d 2021-09-08 20:43:46 UTC
Git commit eb8cbdc72085539863c7b99a674b6536d95857da by Mathias Wein.
Committed on 08/09/2021 at 20:43.
Pushed by mwein into branch 'krita/5.0'.

Fix imprecise dimensions when using image size dialog

Due to the way multiple units are handled, the result can be a tiny bit
smaller then the true value of e.g. 50% of 2816 px, despite qreal precision.
Furthermore, the spinbox will round to nearest integer when you
switch back to pixels, so the final value should consistently be rounded
instead of truncated for non-pixel input units.
(cherry picked from commit b058b377aff035d156e13996b4ffa6f29a5bda9f)

M  +2    -2    libs/ui/imagesize/dlg_imagesize.cc

https://invent.kde.org/graphics/krita/commit/eb8cbdc72085539863c7b99a674b6536d95857da