How to get list of all colors in an image?
can we get 2-3 most frequently used colors in an image?
How to get list of all colors in an image?
can we get 2-3 most frequently used colors in an image?
Hi,
there's a little gem that perhaps you're not aware of.
The InDesign developer Gregor Fellenz (aka grefel) poured some of his skills over the "omv" file (that ESTK uses to render the content in its Object Model Viewer window), to create an HTML display – indexed, searchable, much nicer and friendlier, in my opinion.
You can find it here: https://www.indesignjs.de/extendscriptAPI/photoshop2015.5/
No worries if it says 2015.5 and we're at 2018. Apparently, Adobe didn't bother to update the omv file – because there's nothing new to document in the DOM. I did mention Fellenz's work in this post omv.xml for CC 2018 but I thought it should deserve a more findable Forum entry.
Davide
Good morning
I work for 2 pcs
one windows and one mac
I use many scripts
unfortunately a few times it sucks me that windows works fine but not mac
or on mac well and on windows no
there would be a possibility that if a script runs on windows part of a script
if instead of another part of the mac?
Thank you
Hello,
I want to write a script which creates a new layer.
I'm using app.aciveDocument.artLayers.add() method, however it creates the new layer at the top of the layer list.
Is there any way to create the layer just above the active layer?
Thanks
Hello,
I need to create an action, that runs the script. This script displays a dialog box, with various variables for user to select.
When I choose Automate > Batch and select this action, the dialog box appears for every image.
Is there any way to show the dialog box only once and apply the variables values set within this dialog box to the whole batch of images I want to process?
Thank you!
Im busy making a script which stitches images together using row by row and column by column method. Ive added a couple of script together into one script.
To make the stitch method more clear i made 2 icons. Problem is that windows users get errors when the images need to be loaded.
The icons are placed in the main script folder in the presets folder /Photoshop/Presets/Scripts/row-row.png. Im using OSX as system and there i could use "../row-row.png". This doesnt seems to work properly on windows. So i tried using backslash, but this give errors in the code as the backslash is for include specials.
This is the part which loads the png images;
var f = new File("../blanco.png");
var f1 = new File("../row-row.png");
var f2 = new File("../col-col.png");
I also tried this;
if (File.fs == "Windows"){
var f = File("..\blanco.png");
var f1 = File("..\row-row.png");
var f2 = File("..\col-col.png");
}
if (File.fs == "Macintosh"){
var f = File("../blanco.png");
var f1 = File("../row-row.png");
var f2 = File("../col-col.png");
}
What is the best method to get windows look in the current folder of the presets/scripts/ folder?
Hello!
A question. Is it possible to write a script for Photoshop in which inside the Transformation function the larger side will be 317 pixels, and the second in percentage, and the alignment in the center (X: 158,50 Y: 158,50)?
Good morning
I would like to place this on the top right panel
but the panel is always at the center
how can I do to fix this?
var win = new Window("palette", "PANEL");
win.cancel2Ok = win.add('panel', [10,495,300,540], "");
win.closeButton = win.cancel2Ok.add("button", [10,10,280,35], "CLOSE");
win.onDeactivate = function(){
win.update();
};
var closeWin = false;
win.closeButton.onClick = function(){
closeWin = true;
win.close();
};
win.onClose = function(){
closeWin = true;
};
win.show();
while(closeWin == false){
app.refresh();
};
I have a plugin (.dll) written in C++ that I want to create a custom panel for, so a few questions:
Is this possible?
If so, could you point me in the direction of what I have to use, I understand that I can use ActiveXObject for web to call native dlls in Js. Would this work for Photoshop?
Hello all!
I have a series of very effective scripts that I am running against a series of photoshop files. Now the big quiestion!
Is there a program to
1) "watch" a folder, so when a file is saved in that folder.
2) It runs my script(s) on that file?
If you look at it simply-- I would like to replace the "drag and drop" method used for droplets, with the "drop in the folder" method.
No doubt this would require a separate program, to consistently check the folder for new files.
This is something that I would prefer to tackle with python, but maybe you all in the community could provide me with a more "industry accepted" solution?
Oh and Ideally I would run this on both mac and PC.... though I understand if windows makes more sense for an operation like this.
Best,
Thomas Murphy
When i used color range ,the default selected model is highlight,but i used color range with sampled colors model by scripts in next time ,it stil show the result that is
highlight model.I dont konw why? please help ,thanks!
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); }; var desc1 = new ActionDescriptor(); desc1.putInteger(cTID('Fzns'), 80); var desc2 = new ActionDescriptor(); desc2.putDouble(cTID('Lmnc'), 48.58); desc2.putDouble(cTID('A '), -9.14); desc2.putDouble(cTID('B '), -45.14); desc1.putObject(cTID('Mnm '), cTID('LbCl'), desc2); var desc3 = new ActionDescriptor(); desc3.putDouble(cTID('Lmnc'), 60.86); desc3.putDouble(cTID('A '), -4.64); desc3.putDouble(cTID('B '), -40.1); desc1.putObject(cTID('Mxm '), cTID('LbCl'), desc3); desc1.putInteger(sTID("colorModel"), 0); executeAction(sTID('colorRange'), desc1, DialogModes.NO);I try to add"desc1.putEnumerated(cTID('Clrs'), cTID('Clrs'), sTID("sampledColors"));"before in"desc1.putInteger(sTID("colorModel"), 0);",but it has error
Absolutely gutted, nothing ever made in Photoshop ever came close to it and i have been using it for years
I know there is one in PS and another on GITHUB but nothing comes close to the original script
The things that set it apart was the fact that you could save layers with Prefixes and increment the files with hyphens and numbers such as MFOTL395 and it would merge visible and/or selected layers in to files and name them MFOTL395-01.jpg, MFOTL395-02.jpg and so on
You could also set it to save selected layers along with the top or bottom most layers, including smart objects and backgrounds
Please someone update this script so it works in PS CC 2017, i have it safe if anyone has the talent to do this, it works in CS6 and I think it works in CC 2015
I create t-shirt designs and have all the 13 colours of shirt at the bottom of my file and all the smart vector objects above, i can select all 13 blank coloured t-shirts and merge each one with a selected smart vector object and create all the colour variation images or ebay, amazon, my website etc in seconds for each design
OH GOD, OH NO
I want to extract frame count using JSX script?
I have used following code. But it seems not sharp as expected (In case of decimal point of seconds it seems not good)
functiongetTimelineLength() {
varref = newActionReference();
ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID('duration'));
ref.putClass(stringIDToTypeID('timeline'));
vardesc = newActionDescriptor();
desc.putReference(charIDToTypeID('null'), ref);
varTC = executeAction(charIDToTypeID('getd'), desc, DialogModes.NO);
TC = TC.getObjectValue(stringIDToTypeID('duration'));
varM = 0;
try { M = TC.getInteger(stringIDToTypeID('minutes')); } catch (e) { }
varS = 0;
try { S = TC.getInteger(stringIDToTypeID('seconds')); } catch (e) { }
varF = TC.getInteger(stringIDToTypeID('frame'));
varFR = TC.getInteger(stringIDToTypeID('frameRate'));
varA = newArray();
A.push([[M], [S], [F], [FR]]);
returnA;
}
//option 1
var frameCount = timeLineInfo[0][2] ( But this returns "0" value with newly opened document)
//option 2
var timeLineInfo = getTimelineLength()
var frameCount = timeLineInfo[0][1] * timeLineInfo[0][3] ( This is not returns correct value with decimal value of seconds )
Anyone have a better solution?
Good evening
there would be a way to not close a dialog box by pressing the esc key
or alternatively you could make sure that if you click the esc key off all that was present before using the dialog box.
I want to know Photoshop document has timeline animation using JSX script.
Is there any way to get this information?
I work with 7 digit and 8 digit filenames that are based on skus. They typically look like 100-100_A or 100-1000_A.
Problem #1
Right now I have 2 different scripts that will save into a folder structure based on the filename. One for the 7 digit filenames and one for the 8 digit. Is there anyway to combine these? I am new to scripting and have tried numerous different things with no luck. The scripts may not be perfect but they work.
Problem #2
I would love to work in error checking. These scripts run as part of actions. Right now it only alerts when the file saves. I would like it to return an error if it doesn't save.
Script #1
//only 7 Digit filenames are allowed. ZZ12345_A or 123-456_A
var aDoc = activeDocument, nme = aDoc.name.replace(/\.[^\.]+$/,""), reg = /^.{7}_./, tmp = nme.split("");
checkAndSave();
function checkAndSave() {
if( reg.test( nme ) == false) {
alert ("wrong file name"); return; }
else { tmp.splice(-2);
for( i = 1; i < 7; i++ ) { tmp[i] = tmp[i-1] + tmp[i]; };
var saveFol = Folder ("/Catalog-3/Agility/AgilityImages/Products/7-Digit"); //if script stops saving try changing to /Catalog, /Catalog-1, /Catalog-2 etc. You can also find the active path by running activepath.jsx on a file in the 7-digit product folder.
for ( i = 0; i < tmp.length; i++ ) {
saveFol = Folder( saveFol + "/" + tmp[i] );
if (!saveFol.exists) { saveFol.create() };
};
var saveName = "/" + nme + ".tif";
var saveFile = new File( saveFol + saveName );
if(saveFile.exists){
if(!confirm( saveFile + "\nFile already exists.. Do you want to overwrite?", false, "Overwrite file?"))
return;
}
saveAsTIFF( saveFile ); alert( saveFol + saveName + " saved" )
}; return;
};
function saveAsTIFF( saveFile ) {
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
activeDocument.saveAs( saveFile, tiffSaveOptions, false);
}
Script#2
// only 8 digit filenames allowed. 12345678_A or 123-4567_A
var aDoc = activeDocument, nme = aDoc.name.replace(/\.[^\.]+$/,""), reg = /^.{8}_./, tmp = nme.split("");
checkAndSave();
function checkAndSave() {
if( reg.test( nme ) == false) {
alert ("wrong file name"); return; }
else { tmp.splice(-2);
for( i = 1; i < 8; i++ ) { tmp[i] = tmp[i-1] + tmp[i]; };
var saveFol = Folder ("/Catalog-3/Agility/AgilityImages/Products/8-Digit"); //if script stops saving try changing to /Catalog, /Catalog-1, /Catalog-2 etc. You can also find the active path by running activepath.jsx on a file in the 7-digit product folder.
for ( i = 0; i < tmp.length; i++ ) {
saveFol = Folder( saveFol + "/" + tmp[i] );
if (!saveFol.exists) { saveFol.create() };
};
var saveName = "/" + nme + ".tif";
var saveFile = new File( saveFol + saveName );
if(saveFile.exists){
if(!confirm( saveFile + "\nFile already exists.. Do you want to overwrite?", false, "Overwrite file?"))
return;
}
saveAsTIFF( saveFile ); alert( saveFol + saveName + " saved" )
}; return;
};
function saveAsTIFF( saveFile ) {
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
activeDocument.saveAs( saveFile, tiffSaveOptions, false);
}
Hey guys - I'm working on a simple photoshop CC script that exports selected layers, but I'm having some problems with the selection code.
Googling around I found a helpful snippet that returns a list of layer index values for my selected layers - however the returned indices don't equate to the indices I get when simply using app.activeDocument.layers().
Can anyone suggest a method to get references to the layer objects that are selected? - or perhaps a function to convert the document indices from the function below to their respective layer objects?
Many thanks in advance!
function getSelectedLayersIdx(){
var selectedLayers = new Array;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var desc = executeActionGet(ref);
if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
var c = desc.count
var selectedLayers = new Array();
for(var i=0;i<c;i++){
selectedLayers.push( desc.getReference( i ).getIndex());
}
}else{
var ref = new ActionReference();
ref.putProperty( charIDToTypeID('Prpr') , charIDToTypeID( 'ItmI' ));
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( 'ItmI' )));
}
return selectedLayers;
}
var doc = app.activeDocument;
var layersIndx = getSelectedLayersIdx(doc);
alert("Selected layers indx: "+layersIndx);
for(i =0; i<layersIndx.length; i++){
index= layersIndx[i];
alert("Index: "+index+" Name: "+doc.layers[index].name);
}