![]() |
| Adobe Forums » Software Discussions » PhotoShop » Windows » How to save a jpg and give it a label automatically |
| Tags: |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi guys. I've found myself regularly repeating a set of actions and I was wondering if there was some way of automating them using CS4. The scenario is that I use Bridge as my main photo organisation app. I rate my shots from 1-5 stars and then tend to double click on ones to edit them in PS. After saving the edited shot as a jpg with "_edited" added to the filename, I apply a label which is called 'Enhanced' and then apply a 'Original' label to the original jpg. This lets me immediately filter of my edited/enhanced shots in Bridge and locate the originals if I need them. It also makes the edited files stand out when looked at in a file view of Explorer etc .
Is there an action or script I can create so that when I've finished editing a jpg it will take the original file name, add "_edited", save it as quality 10, baseline optimised, then apply the 'Optimised' label to the new file and exit the original jpg without saving but with applying the 'Original" label? Any advice would be much appreciated. Thanks. |
|
|||
|
I've been playing with 'File, File Info, RAW Data' and tried exporting, stippping down and re-importing the following XML to just contain the change I want to apply to other files:
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:12:18 "> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf escription rdf:about="" xmlns:exif="http://ns.adobe.com/exif/1.0/"><xmp:Label>Enhanced</xmp:Label> </rdf escription></rdf:RDF> </x:xmpmeta> I am trying to use this to set the Label as "Enhanced". However I keep getting an "Error opening the template" message. What am I missing? By recording an action which saves the jpg as a copy, I can at least save the file with ' copy' after it. Is there any way to change this to 'Edited'? Can I also paramaterise the save location so that it will save in whatever location the file was opened in? Cheers. |
|
|||
|
This should do it...
#target photoshop if (!BridgeTalk.isRunning("bridge")) BridgeTalk.launch("bridge"); if(documents.length >0){ var originalFile = activeDocument.fullName.fsName; var saveFile = activeDocument.fullName.fsName.slice(0,-4)+"_edited.jpg"; SaveJPEG(saveFile, 10); activeDocument.close(SaveOptions.DONOTSAVECHANGES) ; labelPic(originalFile,"Original"); labelPic(saveFile,"Enhanced"); ** function labelPic(file,tag) { var bt = new BridgeTalk; bt.target = "bridge"; var myScript = "try {"; myScript += "var file = new Thumbnail(\'"+file+"\');"; myScript += "var md = file.synchronousMetadata;"; myScript += "md.namespace = \"http://ns.adobe.com/xap/1.0/\";"; myScript +="md.Label = \'"+ tag +"\';"; myScript += "**catch(e){**;"; bt.body = myScript; bt.send(); ** function SaveJPEG(saveFile, jpegQuality){ jpgSaveOptions = new JPEGSaveOptions(); jpgSaveOptions.embedColorProfile = true; jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; jpgSaveOptions.matte = MatteType.NONE; jpgSaveOptions.quality = jpegQuality; //1-12 activeDocument.saveAs(new File(saveFile), jpgSaveOptions, true,Extension.LOWERCASE); ** |
|
|||
|
Thank you very much for that Paul, it's very much appreciated! Could I please ask how to run it though? :-) I've been googling what to do with BridgeTalk scripts and I haven't found out yet what I need to do to run this or how to call it from photoshop. I'm not a programmer and I can't seem to find anything in the manual about Bridgetalk. Thank you. JW
|
|
|||
|
This is a Photoshop script.
Copy the script and paste it into "ExtendScript Toolkit" this comes with PhotoShop. Save the script to: It should create a script FileName.jsx (CS2/CS3) or FileName.js (cs) PC:- C:/Program Files/Adobe/Adobe Photoshop CS#/Presets/Scripts/ Mac:- [hard drive]/Applications/Adobe Photoshop CS#/Presets/Scripts/ To run the script : File - Scripts - (select script) You can also create an action to do the above and assign a function key. Another way would be to asign a shortcut key via Edit - Keyboard Shortcuts - File, go down to scripts and the assign a shortcut. Hope this helps. |
|
|||
|
Paul, that's so cool! :-> Thank you very much indeed for that!!
Could I ask though - is it CS3 or 32 bit specific? I've just installed CS4 (64bit) and I've tried running it on a variety of files. A file copy is created with "_edited" after it, but the "Enhanced" tag is not added to the new one, not is the 'Original' tag added to the original file. If there is a previous label it is still present on the copy and if there was none before, there is none on the copy. I have tried running the script manually and as an action, but I am not getting the 'Enchanced' or 'Original' labels I clearly see in the code. Could you possibly comment if I'm doing something wrong, or if the code may need to be tweaked for CS4? Thanks sooooo much. :-) |
|
|||
|
Very strange, I have tested it on Photoshop CS3 and CS4 on a PC with 32bit Vista Home Premium and the labels update without a problem.
I am a bit stuck as I don't have a 64bit system to see where the problem lies. I wonder if anyone out there could do some tests? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|