Bug 475409 - "Paste into active layer" not working with extremely low resolution images.
Summary: "Paste into active layer" not working with extremely low resolution images.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-09 21:39 UTC by Emmet O'Neill
Modified: 2023-10-17 20:40 UTC (History)
1 user (show)

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


Attachments
Video: krita -> krita paste into active layer fails. (2.34 MB, video/webm)
2023-10-10 03:00 UTC, Emmet O'Neill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emmet O'Neill 2023-10-09 21:39:18 UTC
SUMMARY

In my free time I've been working on animating very low resolution (16x16, 24x24, 32x32) pixel art game assets and I've found that I'm unable to use "Paste into Active Layer" to paste individual frames of animation when working on pixel art sized images.

STEPS TO REPRODUCE
1. In one Krita document, create a 24 x 24 pixel image.
2. Select the entire canvas and copy it to your clipboard.
3. Now create another 24 x 24 document.
4. In this new 24 x 24 document, try the `Edit > Paste into active layer` action.

OBSERVED RESULT

I've found that the image fails to be pasted onto the active layer.
And if you select the Transform Tool you'll see a message telling you that you can't transform an empty layer, confirming that nothing has been pasted on or off the canvas.

EXPECTED RESULT

I would like to see the contents of my clipboard be pasted onto the active layer (and active animation frame), preferably in the most logical position on the canvas possible, for example aligned with the upper-left corner of the canvas.
Comment 1 Emmet O'Neill 2023-10-09 21:51:55 UTC
Actually it seems like I can only reproduce this when pasting into Krita from another program.

So I need to correct the steps to reproduce reliably using a second program.

UPDATED STEPS TO REPRODUCE
1. In another program (I've been using Aseprite, but other FOSS options like Pixelorama or LibreSprite should be similar), create a 24 x 24 pixel image.
2. Select the entire canvas (in the source program) and copy it to your clipboard.
3. Now create another 24 x 24 document.
4. In this new 24 x 24 document, try the `Edit > Paste into active layer` action.

(I should say I believe I've had this problem copying pixel art between Krita files in the past, but I was unable to reliably reproduce it just now without getting a second program involved. *shrug*.)
Comment 2 Emmet O'Neill 2023-10-10 03:00:35 UTC
Created attachment 162182 [details]
Video: krita -> krita paste into active layer fails.

Update: Ok, it turns out that this *does* happen between 2 krita documents, though I'm not sure exactly how to reproduce it.

In this case I have a bunch of 24 x 24 sprites packed onto a single sprite sheet, and for some reason I can't copy and paste them into the active layer on my other 24 x 24 document. (Video attached.)
Comment 3 Simon Ra 2023-10-10 10:06:19 UTC
I believe there are two issues here:

1) "paste into active layer" from a raw image source (like another program's "Copy") does not work seemingly at all. this is an easy fix.
2) tentative STR:
2.1) make a new biggish image
2.2) draw something in the bottom right
2.3) select and copy a small region in thing you drew
2.4) create a second image, smaller in size
2.5) paste into active layer
-> canvas does not change, but the preview in the layer docker does
Comment 4 Simon Ra 2023-10-10 12:11:58 UTC
my attempt to fix both issues:
https://invent.kde.org/graphics/krita/-/merge_requests/1956
Comment 5 Emmet O'Neill 2023-10-16 22:42:10 UTC
Git commit 31163c43eacf92c6796668dfbf555f3f88707b24 by Emmet O'Neill, on behalf of Simon Ra.
Committed on 16/10/2023 at 23:46.
Pushed by emmetoneill into branch 'master'.

fix two bugs related to pasting image data into krita, along with some refactoring:
1) "Paste into active layer" not working with non-krita MIME type paste data
2) all types of pastes not correctly detecting when the pasted content is outside of the bounds of the canvas being pasted into

M  +16   -16   libs/ui/actions/KisPasteActionFactories.cpp

https://invent.kde.org/graphics/krita/-/commit/31163c43eacf92c6796668dfbf555f3f88707b24
Comment 6 Emmet O'Neill 2023-10-17 20:40:46 UTC
Git commit 3bbc62a905a015bcee30a165ae86bc136abd6c60 by Emmet O'Neill, on behalf of Simon Ra.
Committed on 17/10/2023 at 22:40.
Pushed by emmetoneill into branch 'krita/5.2'.

fix two bugs related to pasting image data into krita, along with some refactoring:
1) "Paste into active layer" not working with non-krita MIME type paste data
2) all types of pastes not correctly detecting when the pasted content is outside of the bounds of the canvas being pasted into


(cherry picked from commit 31163c43eacf92c6796668dfbf555f3f88707b24)

M  +16   -16   libs/ui/actions/KisPasteActionFactories.cpp

https://invent.kde.org/graphics/krita/-/commit/3bbc62a905a015bcee30a165ae86bc136abd6c60