Mobile app version of vmapp.org
Login or Join
Kaufman565

: Photoshop paste into selection from illustrator and keep it as vector smart object Is there a way that I could paste sth from illustrator into a selection in photoshop? What I want to achieve

@Kaufman565

Posted in: #AdobeIllustrator #AdobePhotoshop #Cs6

Is there a way that I could paste sth from illustrator into a selection in photoshop? What I want to achieve is the effect which could be done in the same way in indesign(make a box and paste into it, that when i move the inside of the box the viewable area should be exactly the box and not the full pasted element)

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman565

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie315

Can't be done without scripting.

Here's a script that I frankensteined together.

A gif where I make a selection and trigger the script via hotkey.



// gist.github.com/joonaspaakko/50778ce2758ed22af0f4
// Pastes clipboard contents into the current selection.
// - Relies on PS option: Preferences > General > Resize image during place
// - The script fits the contents. It could be modified to fill as well.
// - If clipboard contains vector objects, it will brought in as a smart object.
// - If clipboard is empty, the script fails horribly. Didn't bother to make it fail-safe..

var doc = app.activeDocument,
preferences = app.preferences,
rUnits = preferences.rulerUnits,
sDimensions = selectionDimensions( doc, preferences );

var tempDoc = doc.duplicate( null, true);

var tempDocSelection = tempDoc.selection;

tempDoc.resizeImage( sDimensions[0], sDimensions[1] );

paste();

tempDoc.activeLayer.duplicate( doc );
tempDoc.close( SaveOptions.DONOTSAVECHANGES );

align();

applyMask();

preferences.rulerUnits = rUnits;

function selectionDimensions( doc, preferences ) {

preferences.rulerUnits = Units.PIXELS;

var selectionBounds = doc.selection.bounds;

var sX1 = selectionBounds[0].value,
sY1 = selectionBounds[1].value,
sX2 = selectionBounds[2].value,
sY2 = selectionBounds[3].value;

var tempWidth = sX2 - sX1,
tempHeight = sY2 - sY1;

return [tempWidth, tempHeight];
}

function paste() {

// =======================================================
var idpast = charIDToTypeID( "past" );
var desc1482 = new ActionDescriptor();
var idAntA = charIDToTypeID( "AntA" );
desc1482.putBoolean( idAntA, true );
var idAs = charIDToTypeID( "As " );
var idsmartObject = stringIDToTypeID( "smartObject" );
desc1482.putClass( idAs, idsmartObject );
var idpushToDesignLibraries = stringIDToTypeID( "pushToDesignLibraries" );
desc1482.putBoolean( idpushToDesignLibraries, false );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc1482.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc1483 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc1483.putUnitDouble( idHrzn, idPxl, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc1483.putUnitDouble( idVrtc, idPxl, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc1482.putObject( idOfst, idOfst, desc1483 );
executeAction( idpast, desc1482, DialogModes.NO );

}

function align() {
// =======================================================
var idAlgn = charIDToTypeID( "Algn" );
var desc287 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref115 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref115.putEnumerated( idLyr, idOrdn, idTrgt );
desc287.putReference( idnull, ref115 );
var idUsng = charIDToTypeID( "Usng" );
var idADSt = charIDToTypeID( "ADSt" );

var idAdCV = charIDToTypeID( "AdCV" );
desc287.putEnumerated( idUsng, idADSt, idAdCV );
executeAction( idAlgn, desc287, DialogModes.NO );

var idAdCH = charIDToTypeID( "AdCH" );
desc287.putEnumerated( idUsng, idADSt, idAdCH );
executeAction( idAlgn, desc287, DialogModes.NO );
}

function applyMask() {

// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc1556 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var idChnl = charIDToTypeID( "Chnl" );
desc1556.putClass( idNw, idChnl );
var idAt = charIDToTypeID( "At " );
var ref313 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
ref313.putEnumerated( idChnl, idChnl, idMsk );
desc1556.putReference( idAt, ref313 );
var idUsng = charIDToTypeID( "Usng" );
var idUsrM = charIDToTypeID( "UsrM" );
var idRvlS = charIDToTypeID( "RvlS" );
desc1556.putEnumerated( idUsng, idUsrM, idRvlS );
executeAction( idMk, desc1556, DialogModes.NO );

}

10% popularity Vote Up Vote Down


 

@Samaraweera207

The Place Into-command doesn't work well with Smart Objects(in my experience).
If you have made a selection before you paste your Illustrator artwork, you could save your selection: Select = Save Selection...
Or, you could make a temporary mask on your current layer, and drag it onto your Smart Object layer, once placed.

Hope it helps you!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme