Bug 492965 - Image Split tool does not split evenly on guides
Summary: Image Split tool does not split evenly on guides
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools (other bugs)
Version First Reported In: 5.2.3
Platform: Microsoft Windows Microsoft Windows
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-11 03:20 UTC by aarqon
Modified: 2026-06-04 18:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Test file (31.49 KB, application/x-krita)
2026-05-29 01:19 UTC, Tiar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aarqon 2024-09-11 03:20:13 UTC
SUMMARY
Using the "Use guides" options in Image Split results in unevenly split images that are off by one pixel. For instance, setting the guides on a pixel art sheet 16px apart seems to place them with pixel precision, but what should be 16x16 images will come out as 17x15 or 15x15. Attempting to nudge the guides to correct for this only makes the error worse.

STEPS TO REPRODUCE
1. Set up any document
2. Place guides in any pixel-precise pattern (e.g. 16px apart vertically and horizontally)
3. Image > Image Split, check Use Guides on both dimensions, and click Apply

OBSERVED RESULT
Produced images are always 1px off in either direction.

EXPECTED RESULT
Produced images should be split along the actual lines indicated by the guides, which seem to snap precisely to pixel edges at these small resolutions.

SOFTWARE/OS VERSIONS
Windows: 10.0.19045 Build 19045
Krita: 5.2.3 (git 68d178c)
Comment 1 Tiar 2026-05-29 01:19:00 UTC
Created attachment 192703 [details]
Test file
Comment 2 Tiar 2026-05-29 01:20:15 UTC
Confirming. The test file gave me three different horizontal and three different vertical rectangles (and many squares I didn't check), and they were of heights/widths 15, 16 and 17, instead of all being 16.
Comment 3 Aditya Rout 2026-06-04 03:32:50 UTC
The fix has been fixed and merged into via MR !2813. 
The issue was caused by a floating point precision loss during coordinate mapping leading to loss of pixels during width calculation.
Comment 4 Aditya Rout 2026-06-04 03:34:50 UTC
(In reply to Aditya Rout from comment #3)
*issue has been fixed
here's the link to MR for detailed cause : https://invent.kde.org/graphics/krita/-/merge_requests/2813