Artboard without Margin
Is it possible to have an boder-less artboard? That means if I placed an image bigger than the artboard dimension, it will automatically increase it's dimension.

Is it possible to have an boder-less artboard? That means if I placed an image bigger than the artboard dimension, it will automatically increase it's dimension.

For what it's worth, the following script will resize the parent artboard to the size of the selected layer bounds. This could be added to the Script Events Manager for automated triggering via a suitable event.
/*
Set the Parent Artboard Bounds to the Active Layer Bounds.jsx
Stephen Marsh
v1.0 - 9th June 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/artboard-without-margin/m-p/15360958
*/
(function () {
if (app.documents.length === 0) {
alert("No document is open!");
return;
}
if (!hasActiveLayer()) {
alert("No active layer selected!");
return;
}
if (isInvalidLayerType(app.activeDocument.activeLayer)) {
alert("Script aborted: The active layer isn't supported!");
return;
}
var savedRuler = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var layer = doc.activeLayer;
var left = layer.bounds[0];
var top = layer.bounds[1];
var right = layer.bounds[2];
var bottom = layer.bounds[3];
var originalLayer = doc.activeLayer;
// Find the final artboard parent
var finalParentArtboard = findParentArtboard(layer);
if (!finalParentArtboard) {
doc.activeLayer = originalLayer;
alert("No Artboard found as the final parent!");
app.preferences.rulerUnits = savedRuler;
return;
}
// Select the found artboard
doc.activeLayer = finalParentArtboard;
// Change the artboard bounds to match the active layer bounds
var s2t = function (s) { return app.stringIDToTypeID(s); };
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var descriptor3 = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
descriptor.putReference(s2t("null"), reference);
descriptor3.putDouble(s2t("top"), top);
descriptor3.putDouble(s2t("left"), left);
descriptor3.putDouble(s2t("bottom"), bottom);
descriptor3.putDouble(s2t("right"), right);
descriptor2.putObject(s2t("artboardRect"), s2t("classFloatRect"), descriptor3);
descriptor.putObject(s2t("artboard"), s2t("artboard"), descriptor2);
descriptor.putInteger(s2t("changeSizes"), 1);
executeAction(s2t("editArtboardEvent"), descriptor, DialogModes.NO);
// Restore the original ruler units
app.preferences.rulerUnits = savedRuler;
})();
///// Functions /////
function isArtboard() {
try {
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID('layer'), stringIDToTypeID('ordinal'), stringIDToTypeID('targetEnum'));
var options = executeActionGet(r);
return options.hasKey(stringIDToTypeID('artboard'));
} catch (e) {
return false;
}
}
function findParentArtboard(layer) {
var currentLayer = layer;
while (currentLayer.parent !== app.activeDocument) {
app.activeDocument.activeLayer = currentLayer;
if (isArtboard()) {
return currentLayer;
}
currentLayer = currentLayer.parent;
}
app.activeDocument.activeLayer = currentLayer;
if (isArtboard()) {
return currentLayer;
}
return null;
}
function hasActiveLayer() {
try {
// selected layer check by jazz-y
var s2t = stringIDToTypeID;
var r = new ActionReference();
r.putProperty(s2t('property'), s2t('targetLayers'));
r.putEnumerated(s2t("document"), s2t("ordinal"), s2t("targetEnum"));
var desc = executeActionGet(r);
var targetLayers = desc.getList(s2t('targetLayers'));
return targetLayers.count > 0;
} catch (e) {
return false;
}
}
function isInvalidLayerType() {
/*
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-check-layer-kind-using-javascript/m-p/13174707
*/
s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('layerKind'));
r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
var layerKind = executeActionGet(r).getInteger(p);
if (layerKind == 2 || layerKind == 9 || layerKind == 10 || layerKind == 11) {
return true;
}
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.