Page 1 of 1

[Solved] Crop: round corners

Posted: Fri Jan 06, 2023 10:51 am
by es
Let's say I have scanned a small plastic card on a full page (A4) and now would like to cut everything out.
I've cropped most of the the background, but then the card has rounded corners, so some of the unneeded background remains.

I've found the Effect→Frame→Round corners and this would be exactly what I needed in replacing the unneeded background with an alpha channel, except that due to less-than-perfect scanning and cropping, the resulting image is not a perfect rectangle
So basically I'd like to be able to apply a Single Round Corner function instead of Round cornerS. I'd set the same radius for each corner so that they are identical in size, but then I'd manually adjust the position AND rotation of each "round corner box" so that they fit the skewness/position of an individual corner

Is this possible?
(though maybe the proper solution is to actually rotate/crop to a perfect rectangle, but maybe you know of an alternative)

Re: Crop: round corners

Posted: Fri Jan 06, 2023 11:15 am
by forum_adm
Just add an alpha channel and make the corners transparent. Now copy and paste will work as usual.

That is the normal technique.

Re: Crop: round corners

Posted: Fri Jan 06, 2023 1:03 pm
by es
Sorry, I don't understand how to "make the corners transparent" with a curve (I've added the channel via Picture→Alpha channel→add). Which tool/function do I use?

(I've tried to use a few selection/insert circle tools, but they don't let me go off the canvas, and also theres is a convex/concave mismatch)

Re: Crop: round corners

Posted: Mon Jan 09, 2023 11:33 am
by forum_adm
Here is a short sample:
1.jpg
1.jpg (197.19 KiB) Viewed 3372 times
Now select the Magic Wand tool and set the tolerance to i.e. 30%.
2.jpg
2.jpg (28.25 KiB) Viewed 3372 times
Click into the area outside the object:
3.jpg
3.jpg (72.5 KiB) Viewed 3372 times
Select the following command in the menu:
4.jpg
4.jpg (146.58 KiB) Viewed 3372 times
You get the final image with hidden background. You can copy and paste this now:
5.jpg
5.jpg (77.59 KiB) Viewed 3372 times

Re: Crop: round corners

Posted: Mon Jan 09, 2023 2:32 pm
by es
Thanks for the example!
However, it my case it's more complicated — the card itself is ~white (but due to dirt not uniformly white) and the background is white (this is more uniform, it's the color of scanner's white lid), so there is no precision (I've tried with incrementing by 1) that would perfectly capture only the areas outside the card
What would help if I could limit the area where magic wand operates, e.g., preselet a circle/rectangle that only covers this one corner, and then the wand wouldn't look past that area and ignore all the white diffs outside

Still, given that we know the "perfect" shape of the corner — an Ellipse of some sorts — the best tool for the job would be something similar to a sector with the following parameters
  • inner radius B (for a simplified circle example)
  • outer radius A (for a simplified circle example), though not really needed here since it's a corner, so can be ∞
  • angle (40°)
Then all the area ABCD between the inner and outer radii should just get replaced with alpha
(the board attachment quota is exceeded, so can't attach an image, but it'd look something like this https://1.bp.blogspot.com/-7egzFbEeSd4/ ... cles-2.png)

For a non-simplified ellipse example instead of a single radius B you'd need to have F₁,F₂,a or at least allow manual editing like you currently allow for the Ellipse/circle selection tool (though adjusting parameters can be more robust vs dragging, e.g., easier to replicate on other corners)

Re: Crop: round corners

Posted: Mon Jan 09, 2023 4:32 pm
by forum_adm
Can you maybe scan the card with a colored or black background?

You can click multiple times with shift into the sample image for selection of all white.

Re: Crop: round corners

Posted: Mon Jan 09, 2023 8:58 pm
by es
forum_adm wrote: Mon Jan 09, 2023 4:32 pm Can you maybe scan the card with a colored or black background?
The card also has black lines on it :) and some other cards have other colors, but at any rate it'd be too cumbersome to rescan (and have on hand a sheet of color that doesn't match any color on the card as then the wand magic can veer off from the corner); practically, it'd be easier to rotate&crop the card to make it perfectly center-match with the frame and then apply your frame effect so that it matches all the corners (or check another app that maybe has concave tools)
forum_adm wrote: Mon Jan 09, 2023 4:32 pm You can click multiple times with shift into the sample image for selection of all white.
Tried that, unfortunately a few pixels still remain or it overflows into an area it shouldn't, and also I can never be certain that there aren't a few pixels mistakenly selected somewhere else in the main image (I know you have those nice helpful red colored borders around a selected area, but still there is a risk with small selections)

Re: Crop: round corners

Posted: Thu Mar 02, 2023 9:48 am
by es
I can never be certain that there aren't a few pixels mistakenly selected somewhere else in the main image
Had an idea: maybe there should be a way to limit Magic Wand to auto-magically select in the preselected area?

Re: Crop: round corners

Posted: Thu Mar 02, 2023 10:06 am
by forum_adm
Just create a new layer from the selection.

Now use the magic wand tool in the new layer.