• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to count image opened in Photoshop according to orientation

Explorer ,
Jun 03, 2020 Jun 03, 2020

Copy link to clipboard

Copied

Hi Please help me
Is there any script which can count number of horizontal and vertical image opened in photoshop and copy result text to clipboard.
For example I have 12 jpeg image opened in photoshop, out of which 9 are vertical and 3 are horizontal. Is there any script which can count them oriantation wise and copy text 9V3H to clipboard.

Thanks in advance

TOPICS
Actions and scripting

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 03, 2020 Jun 03, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Hi..That was different thread sir 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

The other topic thread was about retrieving the count and orientation of multiple layers in a single document.

 

Is this request different? You now have multiple documents open, all of which have different orientations, landscape, portrait and square? Do you still wish for the square orientation images to be classed as portrait orientation?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Ahh, i misread the question. My apologies for that

 

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Yes sir this is different request...In my first request yes I want square oriantation image to be classed as portrait orientation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

A script can look at all the document open in Photoshop and look at their canvas sizes and count the number of landscapes and portraits and create a name like 9V3H and put out a message 9V3H,  Could even add as document 9V3H that has  a canvas sized to house all the documents visible composite and then stack each document current visible composite into the new document.  Photoshop Scripting is very powerful.  What you script is up to you when you code the script. To put text is the clipboard may require using some system code in Photoshop to copy text to the clipboard you normally have to be in text edit mode with the text highlighted you want to copy to the clipboard.  In Photoshop image are normally copied to the clipboard not text.  Photoshop is an image editor not a text editor though it can edit text to some extent.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Thank you for your responce sir. I am totally new in scripting forum thats why sometime I ask stupid questions like this. Please don't mind. I tried to learn scripting but its very difficult for me as I am very less educated. I will not disturb anyone if anyone can provide me link from where I can learn more about scripting..from basic to advance 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Hi Chikal,

You are not disturbing anyone here. If you want to learn, you can read following articles for the scripting

 

Action Manager Scripting

 

ADOBE PHOTOSHOP SCRIPTING

 

Specifically documenattion for javascript

Adobe Photoshop CC JavaScript Reference

 

It will take some time to learn all these, but yes you can start by writing small scripts. All the best 🙂

 

Best regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Hi, Just in case, It is also possible to get the count of portrait, landscape, square files in a given folder using Adobe Bridge, without opening them.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Or still by Photoshop by: ExternalObject.AdobeXMPScript

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

Test to see which is larger, horizontal size or vertical. Pretty straightforward.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2020 Jun 04, 2020

Copy link to clipboard

Copied

There is no stupid question. If you do not know something and ask for help it not a sign of stupidity it show you want to learn. Scripts are little programs written is an interpreted scripting language. If you can find an existing script that does what you want it shows you are not the only one that works like you do.  If you can not find one you need to code it yourself. You will develop the best actions and scripts yourself for your work-flow. Because you designed them for your work and you know how the work and they work like you want them to.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

I have opened 4Images, 2Verticle and 2Horizontal, I want to script according 2v2h , Is that possible to according orientation to alert(2v2h); ?

I have described in image, please check it ?

Thanks in Advance...

t6.JPG

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

I have no idea what you are asking. I see you have four image open in floating windows two have landscape aspect ratios  two have portrait aspect ratios they are being zoomed to different percentage the all see to have a different number of  pixels.  I have no Idea what you want a script to do?????

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

I want to count the orientation of all images, Like 2h2v 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

I want to count the orientation of all images, Like 2h2v in script

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

All images where on all your system, on a disk, open in Photoshop any particular image file format.   If you want to script something you need to to design the precise functions the script will provide. 

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Yes I saw the thread but i can't find the answar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

#target photoshop

s2t = stringIDToTypeID;

var len = getPropertyDesc('application', p = 'numberOfDocuments').getInteger(s2t(p)),
    result = { v: 0, h: 0 };

for (var i = 1; i <= len; i++) {
    var ratio = getPropertyDesc('document', p = 'width', i).getDouble(s2t(p)) >= getPropertyDesc('document', p = 'height', i).getDouble(s2t(p));
    result[ratio ? 'h' : 'v']++
}

alert(result['v'] + 'v' + result['h'] + 'h')

function getPropertyDesc(target, property, idx) {
    target = s2t(target);
    (r = new ActionReference()).putProperty(s2t('property'), s2t(property));
    idx ? r.putIndex(target, idx) : r.putEnumerated(target, s2t('ordinal'), s2t('targetEnum'));
    return executeActionGet(r);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Thanku so much Very well

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 07, 2022 Sep 07, 2022

Copy link to clipboard

Copied

Count only jpg image ignore the other document and Psd file

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

LATEST

Help this result ? not to  alert

Screenshot 2022-10-07 151000.jpgScreenshot 2022-10-07 151223.jpg 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

A script has no problem processing Photoshop document array  it can process all open document an tally those that  are Landscape,  Square and Portrait and list all that information. You just need to design how you want to preset the info to the user.

 

I do not have such a script.  Here is a script I use that process all open document to append the clipboard to  my open  clipboard document.

/* ==========================================================
// 2013  John J. McAssey (JJMack) 
// ======================================================= */
// This script is supplied as is. It is provided as freeware. 
// The author accepts no liability for any problems arising from its use.

// I set a shortcut key in my case F5 to this Photoshop script mainly for doing Window screen capturing of:
// desktop displays, Active window and selected area copy to clipboard. The script log the cardboard into a document with the name clipboard. 

/*
<javascriptresource>
<about>$$$/JavaScripts/AppendClipboard/About=JJMack's Append Clipboard into Clipboard document.^r^rCopyright 2014 Mouseprints.^r^rJJMack's Script.^r
NOTE:New Clipboard Document will be open if necessary</about>
<category>JJMack's Script</category>
</javascriptresource>
*/

// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

if (!documents.length) {
	NewCliboardDoc (); 
	app.activeDocument.suspendHistory('appendClipboard','main(true)'); // New document opened proceed
	}
else { 	//locate Document clipboard
	for (var i=0;i<app.documents.length;i++) { 
		app.activeDocument=app.documents[i];
		if (app.activeDocument.name == "Clipboard"){break;}
		}
	if (app.activeDocument.name != "Clipboard"){
		NewCliboardDoc ();
		app.activeDocument.suspendHistory('appendClipboard','main(true)'); // New document opened proceed
		}
	else {app.activeDocument.suspendHistory('appendClipboard','main(false)'); }	// Old Clipboard Document found
	}

///////////////////////////////////////////////////////////////////////////////
//                            main function                                  //
///////////////////////////////////////////////////////////////////////////////
function main(newFile) {
	// declare local variables
	var orig_ruler_units = app.preferences.rulerUnits;
	app.preferences.rulerUnits = Units.PIXELS;			// Set the ruler units to PIXELS

	try { 
		activeDocument.paste(); 					    // past in clipboard may fail enclose in try
		var LB = app.activeDocument.activeLayer.bounds;	// Get the bounds of the work layer
		var LWidth = (LB[2].value) - (LB[0].value);		// Area width
		var LHeight = (LB[3].value) - (LB[1].value);	// Area height
		// BOTTOMCENTER BOTTOMLEFT BOTTOMRIGHT MIDDLECENTER MIDDLELEFT MIDDLERIGHT TOPCENTER TOPLEFT TOPRIGHT
		if(newFile) {
			app.activeDocument.resizeCanvas(LWidth, LHeight, AnchorPosition.TOPLEFT);
			app.activeDocument.layers[1].remove();
			}
		else {
			if (LWidth>=app.activeDocument.width) {	app.activeDocument.resizeCanvas(LWidth, app.activeDocument.height + LHeight, AnchorPosition.TOPLEFT);}
			else {app.activeDocument.resizeCanvas(app.activeDocument.width, app.activeDocument.height + LHeight, AnchorPosition.TOPLEFT);}
			}
		app.activeDocument.selection.selectAll();		// select all
		// Left('AdLf'); Right('AdRg'); Top('AdTp'); Bottom('AdBt'); Center Horizontal('AdCH'); Center Vertical('AdCV');
		align("AdLf");align("AdBt");					//Align to selection Left bottom
		app.activeDocument.selection.deselect();
		SetViewFitonScreen();
		//app.purge(PurgeTarget.CLIPBOARDCACHE);
		}
	catch(e) { 
		if(newFile) app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
		alert("Clipboard Empty"); 
		}		

	app.preferences.rulerUnits = orig_ruler_units;			// Reset units to original settings
	}
///////////////////////////////////////////////////////////////////////////////
//                           main function end                               //
///////////////////////////////////////////////////////////////////////////////
function NewCliboardDoc () {
	// app.documents.add([width][, height][, resolution][, name][, mode][, initialFill][, pixelAspectRatio][, bitsPerChannel][, colorProfileName])
	var Clipboard = app.documents.add( null, null, 100, "Clipboard", NewDocumentMode.RGB, null, null, null, "sRGB IEC61966-2.1");
	}

function align(method) {
	var desc = new ActionDescriptor();
			var ref = new ActionReference();
			ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
		desc.putReference( charIDToTypeID( "null" ), ref );
		desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
	executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );
	};

function SetViewFitonScreen() {
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(charIDToTypeID('Mn  '), charIDToTypeID('MnIt'), charIDToTypeID('FtOn'));
    desc1.putReference(charIDToTypeID('null'), ref1);
    executeAction(charIDToTypeID('slct'), desc1, DialogModes.NO);
};

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines