Copy link to clipboard
Copied
lets say i have a selection in the shape of a rectangle, and i need to border the selection. select>modify>border creates a border with rounded corners. what i really need is an offset of the original selection as a border, with sharp corners. how can i do this?
Copy link to clipboard
Copied
That would be best achieved by just manually drawing the selections and combining them. To make it more controllable you can also draw paths and convert them to a selection.
Mylenium
Copy link to clipboard
Copied
One solution to retain the existing selection would be with a script. I don't have time right now, however, I can look into this if there is interest.
Copy link to clipboard
Copied
Hi there,
Thanks for reaching out. We're here to help.
From what I understood, you want to get the edges with sharp corners. There are multiple ways to do it.
Let me help you with one.
1) First, we can use the rectangular shape tool (Shift + U)
2) Select the area, remove the fill and increase the stroke.
3) We go to properties and make the corner radius 0, or you can manually adjust it from the boundaries.
That's how you can get the result quickly and fast.
Let us know if this helps,
Thanks,
Ranjisha
Copy link to clipboard
Copied
You could use Select > Transform Selection, using 100% + X px in the Width and Height fields, with X being twice the offset.
Copy link to clipboard
Copied
That's how I would it too John. @Will5CD1 's intended use of the expanded selection might help us provide a better answer. One issue is that transforming the selection and Alt Shift (Opt Shift) dragging a corner handle expands the selection by as percentage of the initial size, so does not work if you want the same sized border on all four sides. I am sure Stephen could acieve it wi a script though.
I have just tested this and it works.
Start with your rectangular selection, and start a new Action.
Stop recording the Action.
It works a treat and takes less than a second to run on my five year old system. I don't know how to pause an Action to enter the Canvas Size value. Is that doable?
Copy link to clipboard
Copied
I feel I should add to the above that the only reason I did it with an Action is that it seemed like a lot of steps. You could obviously do it all manually, and it would still only take about ten seconds, but I am thinking a lot of people would think it long winded. Like I said in the above post, knowing how the OP needs to use the expanded selection might make all the difference in providing the best solution.
Copy link to clipboard
Copied
I'm still going to look into a script, however, I'm also looking at an action based around QuickMask mode and the Min/Max filters.
Copy link to clipboard
Copied
The Select>Modify>Border command or Select>Fringe in ps 1 and 2 always creates a feathered border
good for getting rid of Halos of a pasted object/image or using Gaussian Blur to blend in a pasted object/image
better.
Anyway, you ca get rid of the feather by:
1. With the selection active after running the Modify Border command, press Q on your keyboard to
enter Quickmask Mode
2. Go to Filter>Other>Maximum with Preserve Squareness, enter about half the value you used in
the Border command.
3. Then go to Image>Adjustments>Threshold and move the slider all the way to the right (255)
4. Unfortunately when doing this and using higher values in the Border command above
about 15, the threshold leave a 1px cutout at each corner, though it's easily corrected by
using the pencil tool set to 1px and just filling in each corner.
5. Press Q to Exit Quick Mask Mode
Copy link to clipboard
Copied
OK, I have just learned a new trick. I had to use Minimum to expand the selection, but it worked with perfectly sharp square corners. Thank you Jeff and Stephen for the heads up.
Copy link to clipboard
Copied
@Will5CD1 wrote:
select>modify>border creates a border with rounded corners. what i really need is an offset of the original selection as a border, with sharp corners. how can i do this?
To clarify, Select > Modify > Border does not create rounded corners, although it appears to. What it has actually done is feathered the selection. This behavior started in CS3, and I have hated it ever since.
To confirm that the issue is actually feathering, try filling your selection after you have made the border.
Jane
Copy link to clipboard
Copied
Here are three scripts to force sharp corners, so should only be used to modify square/rectangular selections...
Border:
/*
Select Modify Border Sharp Corners.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-border-selection-with-sharp-corners/td-p/13260671
Stephen Marsh, v1.0 - 12th October 2022
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/transform-selection-script/td-p/12707931
*/
#target photoshop
function main() {
if (app.documents.length > 0) {
// Save the current ruler units and set to pixels
var origRulers = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// Loop the input prompt until a number is entered
var userInput;
while (isNaN(userInput = prompt("Border Selection (sharp corner):", "")));
// Test if cancel returns null, then terminate the script
if (userInput === null) {
//alert('Script cancelled!');
return
}
// Test if an empty string is returned, then repeat
while (userInput.length === 0) {
userInput = prompt("Blank value not accepted, please enter a value in pixels:", "");
}
// Convert decimal input to integer
var promptValue = parseInt(userInput);
var borderValue = promptValue / 2;
// Original selection bounds
var origSelBounds = activeDocument.selection.bounds;
expandSelection(SelectionType.REPLACE);
contractSelection(SelectionType.DIMINISH);
// Restore the ruler units
app.preferences.rulerUnits = origRulers;
// Functions
function expandSelection(selType) {
var expandArray = [
[origSelBounds[0] - borderValue, origSelBounds[1] - borderValue],
[origSelBounds[2] + borderValue, origSelBounds[1] - borderValue],
[origSelBounds[2] + borderValue, origSelBounds[3] + borderValue],
[origSelBounds[0] - borderValue, origSelBounds[3] + borderValue]
];
activeDocument.selection.select(expandArray, selType, 0, false);
}
function contractSelection(selType) {
var contractArray = [
[origSelBounds[0] + borderValue, origSelBounds[1] + borderValue],
[origSelBounds[2] - borderValue, origSelBounds[1] + borderValue],
[origSelBounds[2] - borderValue, origSelBounds[3] - borderValue],
[origSelBounds[0] + borderValue, origSelBounds[3] - borderValue]
];
activeDocument.selection.select(contractArray, selType, 0, false);
}
} else {
alert('A document must be open to use this script!');
}
}
app.activeDocument.suspendHistory("Select Modify Border Sharp Corners.jsx", "main()");
Expand:
/*
Select Modify Expand Sharp Corners.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-border-selection-with-sharp-corners/td-p/13260671
Stephen Marsh, v1.0 - 12th October 2022
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/transform-selection-script/td-p/12707931
*/
#target photoshop
function main() {
if (app.documents.length > 0) {
// Save the current ruler units and set to pixels
var origRulers = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// Loop the input prompt until a number is entered
var userInput;
while (isNaN(userInput = prompt("Expand Selection (sharp corner):", "")));
// Test if cancel returns null, then terminate the script
if (userInput === null) {
//alert('Script cancelled!');
return
}
// Test if an empty string is returned, then repeat
while (userInput.length === 0) {
userInput = prompt("Blank value not accepted, please enter a value in pixels:", "");
}
// Convert decimal input to integer
var theValue = parseInt(userInput);
// Original selection bounds
var origSelBounds = activeDocument.selection.bounds;
// Expand selection array
var theArray = [
[origSelBounds[0] - theValue, origSelBounds[1] - theValue],
[origSelBounds[2] + theValue, origSelBounds[1] - theValue],
[origSelBounds[2] + theValue, origSelBounds[3] + theValue],
[origSelBounds[0] - theValue, origSelBounds[3] + theValue]
];
// Replace the selection with new selection
activeDocument.selection.select(theArray, SelectionType.REPLACE, 0, false);
// Restore the ruler units
app.preferences.rulerUnits = origRulers;
} else {
alert('A document must be open to use this script!');
}
}
app.activeDocument.suspendHistory("Select Modify Expand Sharp Corners.jsx", "main()");
Contract:
/*
Select Modify Contract Sharp Corners.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-border-selection-with-sharp-corners/td-p/13260671
Stephen Marsh, v1.0 - 12th October 2022
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/transform-selection-script/td-p/12707931
*/
#target photoshop
function main() {
if (app.documents.length > 0) {
// Save the current ruler units and set to pixels
var origRulers = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// Loop the input prompt until a number is entered
var userInput;
while (isNaN(userInput = prompt("Contract Selection (sharp corner):", "")));
// Test if cancel returns null, then terminate the script
if (userInput === null) {
//alert('Script cancelled!');
return
}
// Test if an empty string is returned, then repeat
while (userInput.length === 0) {
userInput = prompt("Blank value not accepted, please enter a value in pixels:", "");
}
// Convert decimal input to integer
var theValue = parseInt(userInput);
// Original selection bounds
var origSelBounds = activeDocument.selection.bounds;
// Contract selection array
var theArray = [
[origSelBounds[0] + theValue, origSelBounds[1] + theValue],
[origSelBounds[2] - theValue, origSelBounds[1] + theValue],
[origSelBounds[2] - theValue, origSelBounds[3] - theValue],
[origSelBounds[0] + theValue, origSelBounds[3] - theValue]
];
// Replace the selection with new selection
activeDocument.selection.select(theArray, SelectionType.REPLACE, 0, false);
// Restore the ruler units
app.preferences.rulerUnits = origRulers;
} else {
alert('A document must be open to use this script!');
}
}
app.activeDocument.suspendHistory("Select Modify Contract Sharp Corners.jsx", "main()");
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more