Jump to content

"Crop to Selection" deletes unselected pixels before crop


Recommended Posts

To reproduce:

 

1. New image

2. Create a new layer.

3. Draw a filled circle on "Layer 2" (keep it in the middle of the image) in a contrasting color from the "Background" layer.

4. Choose magic wand tool, set the Tolerance to 0%, and click anywhere in "Layer 2" except on the circle.

5. Ctrl+I to invert the selection.

6. Image->Crop to Selection (Ctrl+Shift+X).

 

The expected result is a square image with a colored circle on a background, but you can see that the unselected pixels in all layers have been erased before the crop is applied.  "Crop to Selection" should not erase pixels...it should only change the canvas size to match the selection.

 

Link to post
Share on other sites

Please give some screenshots to illustrate exactly what you mean.

 

Crop to Selection will indeed "erase" the pixels that are outside of the selection. That's 100% intentional.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to post
Share on other sites

@nabsltd, Crop to Selection does what it's supposed to do: it leaves only the selected region in the final image. You just don't like what it does.

 

A while ago, I wrote a plugin that may help, called Unselected Rectangle Keeper. For your example,  you'd select the background with the Magic Wand, then run Unselected Rectangle Keeper to delete everything outside the bounding rectangle,. You then can select the transparent region, invert the selection, and crop.

 

Link to post
Share on other sites
10 hours ago, Rick Brewster said:

Crop to Selection will indeed "erase" the pixels that are outside of the selection. That's 100% intentional.

 

Why is it intentional?

 

The "crop" function on pretty much every other paint program just crops, since it's just one more keystroke (delete) before the crop to do the same thing that Paint.NET is doing on "Crop to Selection".  By deleting before the crop, you don't give the user a choice.

 

Also, is it only supposed to delete pixels on the selected layer, or on all layers?  Because it deletes on all layers, which isn't explained in the help file.

 
7 hours ago, MJW said:

A while ago, I wrote a plugin that may help, called Unselected Rectangle Keeper. For your example,  you'd select the background with the Magic Wand, then run Unselected Rectangle Keeper to delete everything outside the bounding rectangle,. You then can select the transparent region, invert the selection, and crop.

 

Thanks...I'll check it out, although I really shouldn't need to resort to a plug-in to do what other programs do by default.

 

Tested it, but it still uses "Crop to Selection" at the end, which means that all the pixels outside the selection on all the other layers are deleted.

 

Since I often have layers with single color fill (to test transparency), I then have to go back and re-fill all of them if I want to do any more editing.

Edited by nabsltd
Link to post
Share on other sites

All you need to do is copy the layer with the circle to the clipboard , create a new document and paste your on this new layer. Now you can crop your circle as you want (without affecting any other layers). :) If you need this cropped circle in your previous document, just copy it to the clipboard and paste on the original layer. 

 

By the way cropping the circle will result in a square layer. Round layers do not exist.

Edited by Eli
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...