How to save layered PDD file as JPG?
Hi, folks:
[running Photoshop CS3 under Windows XP Pro/SP3 ]
I have a PSD file with about 14 layers. A few are hidden. I want to save as a jpg, so I go to file -> save as and save as a jpg file (the yellow alert icon shows next to "layers" in the save dialog). Yet the resulting jpg looks just fine. I've been doing this for years.
Today, support told me in case #180459305 that doing that would corrupt the jpg. They said that I need to first merge layers in the PSD file, then save as a jpg.
They also suggested that I post this question here. So here it is. Do I have to go through the extra step in manually flattening the PSD file (and potential pitfall of mistakenly saving it as a PSD and losing my layers forever)?
Thanks,
Fred
Hi, Ed, J:
Thanks for your responses!
His explanation was as follows:
Save the layered PSD as a jpg. When you do so, a yellow exclamation alert appears next to "layers" in the save dialogue box. He said this means that the file will be corrupted if it is saved.
Now I believe it means that layers will be merged during the process of saving as a jpg, and I said so. He said no, let me prove it to you:
Go to Image->mode-> and set 16 bits per channel. Then save as a jpg. You will notice that there is no way to save an image as a jpg. Now how the hell that proves his former point is beyond me.
Now for the biggest laugh of the day: he said (in case#180459305) that if you copy or rename files using the filesystem filemanager (e.g., the desktop or windows explorer), that it would open the file to copy or rename it and then rewrite it, thus cause lossy image degradation.
I told him (politely) that he was wrong - that renaming a file does not open it - it simply updates directory information about the file, and that copying a file (outside of photoshop) does a byte-for-byte clone of the file and does not degrade image quality.
Where do they get these purported "experts"????
Cheers,
Fred
Similar Messages
-
Please can someone tell me how to save a MP3 file from my email on my iPad so I can put it on Faceboo? I use hotmail and please tell me step by step as I am not a tech guru lol. Thankyou
Hi jscher200,
Thank you for your reply, sorry for the VERY late late response, but I have just figured out how to control this separate 'panel'. I find it really useful for monitoring Google Analytics in as it can just sit there running. It does have its limitations, as it's a limited size (you can't expand it to full screen view), so you can only ever see a vertical section of a website and need to scroll to look to the right or left, but I have the live view of people accessing my website running on there and if the numbers start racking up at any time, I can scroll to look and see what pages they are accessing, where they've been referred from, etc.
To get it to work, you save a website address in the Bookmarks Toolbar and when you can see it sitting on the toolbar at the top of the screen with its little icon, right click on it then click 'properties', then tick the box 'Load this bookmark in the sidebar'. The next time you click on this bookmark to open the website, it will load in this sidebar, which looks like a separate 'window' but is immovable. You can only have one sidebar application running at a time, but can change it by right clicking on the bookmark you want to load in there and it will then change to that one next time you click on that bookmark.
I hope this might be useful to others, as I asked for help with this on loads of forums and not one person knew that this existed - even really skilled techies! -
Can't save layered .psd files in Photoshop CS3
Hello,
I noticed yesterday that I can no longer save layered .psd files to any folder. What does get saved is only a generic file symbol.
I'm using a Dell 8200 computer, 1GB of RAM, IntelPentium4 processer, Windows XP Professional,and a Canon MP780 multiple function printer.
Please help.
Thanks,
George MasiIs it saved incorrectly, or is the problem just that the icon is the generic one. In other words, can you A) click to open the file from the desktop. And, b) if you can't click from the desktop, can you open the file from within Photoshop, and see the layers correctly.
If B works, and A does not, then this means your Windows has lost the association between PSD files and Photoshop. You can often correct this by right clicking the file, and choosing Open With, with the Always open with this program field checked. There is also a way to set the icons back up, but this is more complicated. -
How to batch convert bmp files into jpg by dos command or c# program language?
How to batch convert bmp files into jpg by dos command or c# program language?
Many thanks for replying.Try
GraphicsMagick. -
How to save the report file in network drive
Hi experts,
Can any one of you pls tell me how can save the report file in network drive.
My requirement:
by running a report i wll get daily data into a list.SO, i want to keep this in a common drive (network drive:Z) where every one can acces the txt file.
I want the code in SAP to design this.
Awaiting for an early reply.Is the Z drive in the application or presentation server ?
make sure the server has write access to the required folder
for presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\test_xls.xls'
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = itab.
for the application server, use
data: outfile(120).
OPEN DATASET outfile FOR APPENDING IN TEXT MODE ENCODING DEFAULT. -
How to save a numbers file to a pdf file of multiple pages instead of one giant long page?
How to save a numbers file to a pdf file of multiple pages instead of one giant long page?
Hi DW,
Numbers 3.2.2
Instead of Menu > File > Export To, use Menu > File > Print...
That takes you to Print Preview.
In the Print Setup panel, Click on the Print... button lower right (it won't print yet).
That opens the Print Dialogue.
Click on the PDF Pop-Up Menu lower left.
Choose Open PDF in Preview or Save as PDF.
That will have page breaks and will be full sized.
Print from Preview.
Regards,
Ian. -
How To save a music file from an email
PLEASE HELP ME I CANT FIGURE OUT HOW TO SAVE SONG FROM MY ITUNES LIBRARY THAT U SENT TO MY EMAIL
Post relates to: Pixi Plus p8wu0 (AT&T)Open email attachments
You can receive any kind of file sent to you in email, but you can open an
attachment only if your phone has an application that can open the file type.
To open a single attachment: Tap the attachment name to download the
attachment. If the attachment is a supported file type (MP3, PDF, DOC,
XLS, PPT, GIF, or JPG), it opens automatically.
To open multiple attachments: Tap the list of attachment names to view
the attachments, and tap an attachment name to open the file.
Save attachments;
When you open attachments of certain file types, you can save them to your
phone so you can view them later in one of your phone’s applications.
1. Open the attachment (see Open email attachments).
2. Do one of the following:
• For pictures in JPG, GIF, BMP or PNG format, tap Copy To Photos.
• For other file types, open the application menu and tap Save As. If
the Save As menu item is not available, you cannot save the
attachment.
To open a saved attachment on your phone, open the application that can
display the attachment. The attachment appears in the list of available files.
Tap the file to open it.
You can find this info. on page 74 of the user guide.
For reference purposes, click on the following link for the support page for your device on the kb.palm.com webpage.
http://kb.palm.com/wps/portal/kb/na/pixi/pixi/att/home/page_en.html
There are links on the page to the user guide, troubleshooting, how to's, downloads, etc. -
How do you convert psd files to jpg files?
Raw photos were converted to psd and then to jpg. The jpg files were imported and some got reconverted to psd files again. How can I convert them back to jpg files so that I can put them in a photo book?
the basic answer is to open them in Photoshop and save as a jpeg to the desktop and import the JPEG into iPhoto
Raw photos were converted to psd and then to jpg. The jpg files were imported and some got reconverted to psd files again. How can I convert them back to jpg files so that I can put them in a photo book?
perhaps a bit more information would allow a better answer
And remember to never go into the iPhoto library directly and never make any changes to the structure or contents of the iPhoto library
LN -
How to save a picture file into Microsoft Access Database?
I want to save a picture file,such example.jpg file into a Microsoft Access Database in JSP,anybody know how to save picture file into Microsoft Access Database and read this picture file from Microsoft Access Database and then show this picture in a JSP page?
Thanks in advance.Not posible in case of Microsoft Access ..
You will hv to use oracle for that ....
search for Blob / Clob -
How to save layers with cropping?
I want to export layers to files (basically what "Export Layers To Files.jsx" does) but with cropping each layer (to different sizes). I know how to crop a document from script, but that also crops all other layers (erases their content outside of the cropping area). So my question is - how do I keep/retrieve the cropped out content of the document (layers)? Or maybe there's a better approach altogether?
Seems to me that you only need to keep the cropped pixels because of way you want to do this.
However if you want to do it this way you could create a history snapshot, crop and save the first layer. Then restore the document using the snapshot and crop and save the second.
Or you may be able to just store the current history state in a variable then restore the document using that history state if you are only using a few history states to crop and save.
With a snapshot you don't have to worry about the number of history states but it needs action manager. Storing the current history state can be done using the DOM. -
How to save an Excel file to the desk top
How can I save an Excel file to the desk top?
Hi Tim!
There's a whole bunch of entries that come up when I open terminal and key in the command you gave; here's what is shown:
Davids-Mac-Pro:Desktop pdf3$ ls -ale ~
total 38384
drwxrwxrwx+ 41 pdf3 admin 1394 Nov 2 09:12 .
0: group:everyone deny delete
drwxr-xr-x 6 root admin 204 Sep 19 14:58 ..
-rw-rw-rw- 1 pdf3 admin 3 Jan 24 2012 .CFUserTextEncoding
-rw-rw-rw-@ 1 pdf3 admin 39940 Nov 3 10:48 .DS_Store
drwx------ 2 pdf3 admin 68 Nov 6 09:02 .Trash
drwxrwxrwx 3 pdf3 admin 102 Feb 1 2012 .adobe
-rw-rw-rw- 1 pdf3 admin 302 Nov 6 09:20 .bash_history
drwxrwxrwx 6 pdf3 admin 204 Dec 31 2013 .blurb
drwxrwxrwx 3 pdf3 admin 102 Oct 21 2012 .config
drwxrwxrwx 3 pdf3 admin 102 Jan 27 2012 .cups
drwx------ 7 pdf3 admin 238 Jul 26 20:36 .dropbox
drwxr-xr-x 4 pdf3 admin 136 Dec 7 2013 .fontconfig
drwxrwxrwx 3 pdf3 admin 102 Mar 17 2012 .nchsoftware
-rw-rw-rw-@ 1 pdf3 admin 17 Oct 21 2012 .vbftpxmn
-rw-r--r--@ 1 pdf3 admin 1315548 Sep 3 2013 2014 Bellevue SW Collection Contract 04 15 2013 draft for RFP.pdf
drwxrwxrwx 2 pdf3 admin 68 Sep 21 11:04 Applications
-rw-r--r--@ 1 pdf3 admin 326665 Aug 30 2013 Bellevue Reliability Report 2012 042613 Final-1.pdf
-rw-r--r-- 1 pdf3 admin 6737 Sep 25 2013 Bellevue Reliability Report 2012 042613 Final.txt
-rw-r--r--@ 1 pdf3 admin 35892 Oct 30 22:15 Bellevue Utility Bills, 2015-16.xlsx
drwxrwxrwx@ 3 pdf3 admin 102 Aug 16 14:52 Burn Folder.fpbf
-rw-rw-rw-@ 1 pdf3 admin 25989 Jun 18 2012 Concerns Expressed to City of Bellevue Regarding Approval of.pdf
-rw-r--r--@ 1 pdf3 admin 165592 Sep 5 2013 David's Autobiography copy.pdf
-rw-r--r--@ 1 pdf3 staff 34836 Jul 26 21:21 Deck Repair, 2014.xlsx
drwx---rwx@ 35 pdf3 staff 1190 Nov 5 12:54 Desktop
0: group:admin allow list,add_file,search,add_subdirectory,readattr,writeattr,readextattr,writeextat tr,readsecurity
-rw-r--r--@ 1 pdf3 admin 111548 Nov 15 2013 Document2.pdf
drwx------+ 18 pdf3 staff 612 Nov 5 11:43 Documents
0: group:everyone deny delete
drwx------+ 494 pdf3 staff 16796 Nov 2 22:09 Downloads
0: group:everyone deny delete
drwxr-xr-x 2 pdf3 admin 68 Nov 1 11:54 Excel Work Book
drwxr-xr-x 2 pdf3 admin 68 Oct 31 20:42 Excel Workbooks
-rw-rw-rw-@ 1 pdf3 admin 16862554 May 29 2012 Group Shot.psd
drwx------@ 53 pdf3 staff 1802 Sep 19 15:17 Library
0: group:everyone deny delete
drwx------+ 6 pdf3 staff 204 May 28 2013 Movies
0: group:everyone deny delete
drwx------+ 8 pdf3 staff 272 Feb 24 2014 Music
0: group:everyone deny delete
-rw-rw-rw-@ 1 pdf3 admin 117444 Jul 21 2008 P6M-2 In Close copy.jpg
-rw-r--r--@ 1 pdf3 admin 46473 Aug 16 14:50 PW-M-1 Overlay Budget.xlsx
drwx------+ 65 pdf3 staff 2210 Nov 5 11:43 Pictures
0: group:everyone deny delete
drwxr-xr-x+ 5 pdf3 staff 170 Jan 24 2012 Public
0: group:everyone deny delete
drwxr-xr-x 6 pdf3 admin 204 Mar 10 2014 Sound Transit Bel-Red Cost Estimate
drwxr-xr-x 34 pdf3 admin 1156 Sep 21 09:24 WW II Songs & Opera #1
-rw-r--r--@ 1 pdf3 admin 172859 Feb 25 2014 photo 1.JPG
-rw-r--r--@ 1 pdf3 admin 172859 Feb 25 2014 photo 3.JPG
Davids-Mac-Pro:Desktop pdf3$
I have no idea what all this stuff means, but I've done a 'disk verify' for both my drives, and the results indicated they were both 'OK'.Dave P. -
How batch export layers to files png in cc
I am having trouble with an export layers to files script i am wanting to batch export layer to png and this script i have seems to be the one i want although every time i run the script i get this error message "could not complete the action since the destination folder doesn't exist" the script required me to hard code my destination path the path i require is "C:/Users/Tim/Desktop/Backdrops/png/" I am not completely sure why its stating it does not exist any help would be greatly appreciated. i have tried to contact the creator but the post it was on was very old.
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
//=================================================================
// Globals
//=================================================================
var exportPath = "/Users/pedr/Documents/Work/Clients/Pathways/Learning_Hub/Source/Comics/export";
exportPath = exportPath + '/layers';
// UI strings to be localized
var strTitle = localize("$$$/JavaScripts/X2L/Title=X2L");
var strButtonRun = localize("$$$/JavaScripts/X2L/Run=Run");
var strButtonCancel = localize("$$$/JavaScripts/X2L/Cancel=Cancel");
var strHelpText = localize("$$$/JavaScripts/X2L/Help=Please specify the format and location for saving each layer as a file.");
var strLabelDestination = localize("$$$/JavaScripts/X2L/Destination=Destination:");
var strButtonBrowse = localize("$$$/JavaScripts/X2L/Browse=&Browse...");
var strLabelFileNamePrefix = localize("$$$/JavaScripts/X2L/FileNamePrefix=File Name Prefix:");
var strCheckboxVisibleOnly = localize("$$$/JavaScripts/X2L/VisibleOnly=&Visible Layers Only");
var strLabelFileType = localize("$$$/JavaScripts/X2L/FileType=File Type:");
var strCheckboxIncludeICCProfile = localize("$$$/JavaScripts/X2L/IncludeICC=&Include ICC Profile");
var strJPEGOptions = localize("$$$/JavaScripts/X2L/JPEGOptions=JPEG Options:");
var strLabelQuality = localize("$$$/JavaScripts/X2L/Quality=Quality:");
var strCheckboxMaximizeCompatibility = localize("$$$/JavaScripts/X2L/Maximize=&Maximize Compatibility");
var strTIFFOptions = localize("$$$/JavaScripts/X2L/TIFFOptions=TIFF Options:");
var strLabelImageCompression = localize("$$$/JavaScripts/X2L/ImageCompression=Image Compression:");
var strNone = localize("$$$/JavaScripts/X2L/None=None");
var strPDFOptions = localize("$$$/JavaScripts/X2L/PDFOptions=PDF Options:");
var strLabelEncoding = localize("$$$/JavaScripts/X2L/Encoding=Encoding:");
var strTargaOptions = localize("$$$/JavaScripts/X2L/TargaOptions=Targa Options:");
var strLabelDepth = localize("$$$/JavaScripts/X2L/Depth=Depth:");
var strRadiobutton16bit = localize("$$$/JavaScripts/X2L/Bit16=16bit");
var strRadiobutton24bit = localize("$$$/JavaScripts/X2L/Bit24=24bit");
var strRadiobutton32bit = localize("$$$/JavaScripts/X2L/Bit32=32bit");
var strBMPOptions = localize("$$$/JavaScripts/X2L/BMPOptions=BMP Options:");
var strAlertSpecifyDestination = localize("$$$/JavaScripts/X2L/SpecifyDestination=Please specify destination.");
var strAlertDestinationNotExist = localize("$$$/JavaScripts/X2L/DestionationDoesNotExist=Destination does not exist.");
var strTitleSelectDestination = localize("$$$/JavaScripts/X2L/SelectDestination=Select Destination");
var strAlertDocumentMustBeOpened = localize("$$$/JavaScripts/X2L/OneDocument=You must have a document open to export!");
var strAlertNeedMultipleLayers = localize("$$$/JavaScripts/X2L/NoLayers=You need a document with multiple layers to export!");
var strAlertWasSuccessful = localize("$$$/JavaScripts/X2L/Success= was successful.");
var strUnexpectedError = localize("$$$/JavaScripts/X2L/Unexpected=Unexpected error");
var strMessage = localize("$$$/JavaScripts/X2L/Message=X2L");
var stretQuality = localize( "$$$/locale_specific/JavaScripts/X2L/ETQualityLength=30" );
var stretDestination = localize( "$$$/locale_specific/JavaScripts/X2L/ETDestinationLength=160" );
var strddFileType = localize( "$$$/locale_specific/JavaScripts/X2L/DDFileType=100" );
var strpnlOptions = localize( "$$$/locale_specific/JavaScripts/X2L/PNLOptions=100" );
var strPNG8Options = localize("$$$/JavaScripts/X2L/PNG8Options=PNG-8 Options:");
var strCheckboxPNGTransparency = localize("$$$/JavaScripts/X2L/Transparency=Transparency");
var strCheckboxPNGInterlaced = localize("$$$/JavaScripts/X2L/Interlaced=Interlaced");
var strCheckboxPNGTrm = localize("$$$/JavaScripts/X2L/Trim=Trim Layers");
var strPNG24Options = localize("$$$/JavaScripts/X2L/PNG24Options=PNG-24 Options:");
// the drop down list indexes for file type
var png24Index = 7;
main();
// Functions
// Function: main
// Usage: the core routine for this script
// Input: <none>
// Return: <none>
function main() {
if ( app.documents.length <= 0 ) {
if ( DialogModes.NO != app.playbackDisplayDialogs ) {
alert( strAlertDocumentMustBeOpened );
return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
var exportInfo = new Object();
initExportInfo(exportInfo);
// look for last used params via Photoshop registry, getCustomOptions will throw if none exist
try {
catch(e) {
// it's ok if we don't have any options, continue with defaults
try {
var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.
var layerCount = app.documents[docName].layers.length;
var layerSetsCount = app.documents[docName].layerSets.length;
if ((layerCount <= 1)&&(layerSetsCount <= 0)) {
if ( DialogModes.NO != app.playbackDisplayDialogs ) {
alert( strAlertNeedMultipleLayers );
return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
} else {
var rememberMaximize;
var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
app.activeDocument = app.documents[docName];
var duppedDocument = app.activeDocument.duplicate();
duppedDocument.activeLayer = duppedDocument.layers[duppedDocument.layers.length-1]; // for removing
setInvisibleAllArtLayers(duppedDocument);
exportChildren(duppedDocument, app.documents[docName], exportInfo, duppedDocument, exportInfo.fileNamePrefix);
duppedDocument.close( SaveOptions.DONOTSAVECHANGES );
if ( rememberMaximize != undefined ) {
app.preferences.maximizeCompatibility = rememberMaximize;
if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
//alert(strTitle + strAlertWasSuccessful);
app.playbackDisplayDialogs = DialogModes.ALL;
} catch (e) {
if ( DialogModes.NO != app.playbackDisplayDialogs ) {
alert(e);
return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
// Function: settingDialog
// Usage: pop the ui and get user settings
// Input: exportInfo object containing our parameters
// Return: on ok, the dialog info is set to the exportInfo object
function settingDialog(exportInfo) {
return;
// Function: hideAllFileTypePanel
// Usage: hide all the panels in the common actions
// Input: <none>, dlgMain is a global for this script
// Return: <none>, all panels are now hidden
function hideAllFileTypePanel() {
// Function: initExportInfo
// Usage: create our default parameters
// Input: a new Object
// Return: a new object with params set to default
function initExportInfo(exportInfo) {
//exportInfo.destination = new String(exportPath);
exportInfo.fileNamePrefix = new String("untitled_");
exportInfo.visibleOnly = false;
exportInfo.fileType = png24Index;
exportInfo.icc = true;
exportInfo.png24Transparency = true;
exportInfo.png24Interlaced = false;
exportInfo.png24Trim = true;
try {
exportInfo.destination = Folder(new String(exportPath)).fsName; // destination folder
var tmp = app.activeDocument.fullName.name;
exportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf("."))); // filename body part
} catch(someError) {
exportInfo.destination = new String(exportPath);
exportInfo.fileNamePrefix = app.activeDocument.name; // filename body part
// Function: saveFile
// Usage: the worker routine, take our params and save the file accordingly
// Input: reference to the document, the name of the output file,
// export info object containing more information
// Return: <none>, a file on disk
function saveFile( docRef, fileNameBody, exportInfo) {
saveFile(docRef, fileNameBody, exportInfo, false, true);
function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
var id6 = charIDToTypeID( "Expr" );
var desc3 = new ActionDescriptor();
var id7 = charIDToTypeID( "Usng" );
var desc4 = new ActionDescriptor();
var id8 = charIDToTypeID( "Op " );
var id9 = charIDToTypeID( "SWOp" );
var id10 = charIDToTypeID( "OpSa" );
desc4.putEnumerated( id8, id9, id10 );
var id11 = charIDToTypeID( "Fmt " );
var id12 = charIDToTypeID( "IRFm" );
var id13 = charIDToTypeID( "PN24" );
desc4.putEnumerated( id11, id12, id13 );
var id14 = charIDToTypeID( "Intr" );
desc4.putBoolean( id14, interlacedValue );
var id15 = charIDToTypeID( "Trns" );
desc4.putBoolean( id15, transparencyValue );
var id16 = charIDToTypeID( "Mtt " );
desc4.putBoolean( id16, true );
var id17 = charIDToTypeID( "MttR" );
desc4.putInteger( id17, 255 );
var id18 = charIDToTypeID( "MttG" );
desc4.putInteger( id18, 255 );
var id19 = charIDToTypeID( "MttB" );
desc4.putInteger( id19, 255 );
var id20 = charIDToTypeID( "SHTM" );
desc4.putBoolean( id20, false );
var id21 = charIDToTypeID( "SImg" );
desc4.putBoolean( id21, true );
var id22 = charIDToTypeID( "SSSO" );
desc4.putBoolean( id22, false );
var id23 = charIDToTypeID( "SSLt" );
var list1 = new ActionList();
desc4.putList( id23, list1 );
var id24 = charIDToTypeID( "DIDr" );
desc4.putBoolean( id24, false );
var id25 = charIDToTypeID( "In " );
desc4.putPath( id25, new File( exportPath + "C:/Users/Tim/Desktop/Backdrops/png/" + fileNameBody + ".png") );
var id26 = stringIDToTypeID( "SaveForWeb" );
desc3.putObject( id7, id26, desc4 );
executeAction( id6, desc3, DialogModes.NO );
// Function: zeroSuppress
// Usage: return a string padded to digit(s)
// Input: num to convert, digit count needed
// Return: string padded to digit length
function zeroSuppress (num, digit) {
var tmp = num.toString();
while (tmp.length < digit) {
tmp = "0" + tmp;
return tmp;
// Function: setInvisibleAllArtLayers
// Usage: unlock and make invisible all art layers, recursively
// Input: document or layerset
// Return: all art layers are unlocked and invisible
function setInvisibleAllArtLayers(obj) {
for( var i = 0; i < obj.artLayers.length; i++) {
obj.artLayers[i].allLocked = false;
obj.artLayers[i].visible = false;
for( var i = 0; i < obj.layerSets.length; i++) {
setInvisibleAllArtLayers(obj.layerSets[i]);
// Function: removeAllInvisibleArtLayers
// Usage: remove all the invisible art layers, recursively
// Input: document or layer set
// Return: <none>, all layers that were invisible are now gone
function removeAllInvisibleArtLayers(obj) {
for( var i = obj.artLayers.length-1; 0 <= i; i--) {
try {
if(!obj.artLayers[i].visible) {
obj.artLayers[i].remove();
catch (e) {
for( var i = obj.layerSets.length-1; 0 <= i; i--) {
removeAllInvisibleArtLayers(obj.layerSets[i]);
// Function: removeAllEmptyLayerSets
// Usage: find all empty layer sets and remove them, recursively
// Input: document or layer set
// Return: empty layer sets are now gone
function removeAllEmptyLayerSets(obj) {
var foundEmpty = true;
for( var i = obj.layerSets.length-1; 0 <= i; i--) {
if( removeAllEmptyLayerSets(obj.layerSets[i])) {
obj.layerSets[i].remove();
} else {
foundEmpty = false;
if (obj.artLayers.length > 0) {
foundEmpty = false;
return foundEmpty;
// Function: zeroSuppress
// Usage: return a string padded to digit(s)
// Input: num to convert, digit count needed
// Return: string padded to digit length
function removeAllInvisible(docRef) {
removeAllInvisibleArtLayers(docRef);
removeAllEmptyLayerSets(docRef);
// Function: exportChildren
// Usage: find all the children in this document to save
// Input: duplicate document, original document, export info,
// reference to document, starting file name
// Return: <none>, documents are saved accordingly
function exportChildren(dupObj, orgObj, exportInfo, dupDocRef, fileNamePrefix) {
for( var i = 0; i < dupObj.artLayers.length; i++) {
if (exportInfo.visibleOnly) { // visible layer only
if (!orgObj.artLayers[i].visible) {
continue;
dupObj.artLayers[i].visible = true;
var layerName = dupObj.artLayers[i].name; // store layer name before change doc
var duppedDocumentTmp = dupDocRef.duplicate();
if ((png24Index == exportInfo.fileType)||(png8Index == exportInfo.fileType)) { // PSD: Keep transparency
removeAllInvisible(duppedDocumentTmp);
//PNGFileOptions
if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
app.activeDocument.trim(TrimType.TRANSPARENT);
} else { // just flatten
duppedDocumentTmp.flatten();
// Edit
var docName = app.activeDocument.name;
// For some reason indexOf fails if we include the '-', so we use 'copy' and decrement the index by 1.
docName = docName.slice(0, docName.indexOf('copy')-1);
var fileNameBody = (docName+'_'+layerName).toLowerCase();
fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|]/g, "_"); // '/\:*?"<>|' -> '_'
if (fileNameBody.length > 120) {
fileNameBody = fileNameBody.substring(0,120);
saveFile(duppedDocumentTmp, fileNameBody, exportInfo);
duppedDocumentTmp.close(SaveOptions.DONOTSAVECHANGES);
dupObj.artLayers[i].visible = false;
for( var i = 0; i < dupObj.layerSets.length; i++) {
if (exportInfo.visibleOnly) { // visible layer only
if (!orgObj.layerSets[i].visible) {
continue;
var fileNameBody = fileNamePrefix;
fileNameBody += "_" + zeroSuppress(i, 4) + "s";
exportChildren(dupObj.layerSets[i], orgObj.layerSets[i], exportInfo, dupDocRef, fileNameBody); // recursive call
// Function: objectToDescriptor
// Usage: create an ActionDescriptor from a JavaScript Object
// Input: JavaScript Object (o)
// object unique string (s)
// Pre process converter (f)
// Return: ActionDescriptor
// NOTE: Only boolean, string, number and UnitValue are supported, use a pre processor
// to convert (f) other types to one of these forms.
// REUSE: This routine is used in other scripts. Please update those if you
// modify. I am not using include or eval statements as I want these
// scripts self contained.
function objectToDescriptor (o, s, f) {
o = {};
var d = new ActionDescriptor;
var l = o.reflect.properties.length;
d.putString( app.charIDToTypeID( 'Msge' ), s );
for (var i = 0; i < l; i++ ) {
var k = o.reflect.properties[i].toString();
if (k == "__proto__" || k == "__count__" || k == "__class__" || k == "reflect")
continue;
var v = o[ k ];
k = app.stringIDToTypeID(k);
switch ( typeof(v) ) {
case "boolean":
d.putBoolean(k, v);
break;
case "string":
d.putString(k, v);
break;
case "number":
d.putDouble(k, v);
break;
default:
if ( v instanceof UnitValue ) {
var uc = new Object;
uc["px"] = charIDToTypeID("#Rlt"); // unitDistance
uc["%"] = charIDToTypeID("#Prc"); // unitPercent
d.putUnitDouble(k, uc[v.type], v.value);
} else {
throw( new Error("Unsupported type in objectToDescriptor " + typeof(v) ) );
return d;
// Function: descriptorToObject
// Usage: update a JavaScript Object from an ActionDescriptor
// Input: JavaScript Object (o), current object to update (output)
// Photoshop ActionDescriptor (d), descriptor to pull new params for object from
// object unique string (s)
// JavaScript Function (f), post process converter utility to convert
// Return: Nothing, update is applied to passed in JavaScript Object (o)
// NOTE: Only boolean, string, number and UnitValue are supported, use a post processor
// to convert (f) other types to one of these forms.
// REUSE: This routine is used in other scripts. Please update those if you
// modify. I am not using include or eval statements as I want these
// scripts self contained.
function descriptorToObject (o, d, s, f) {
var l = d.count;
if (l) {
var keyMessage = app.charIDToTypeID( 'Msge' );
if ( d.hasKey(keyMessage) && ( s != d.getString(keyMessage) )) return;
for (var i = 0; i < l; i++ ) {
var k = d.getKey(i); // i + 1 ?
var t = d.getType(k);
strk = app.typeIDToStringID(k);
switch (t) {
case DescValueType.BOOLEANTYPE:
o[strk] = d.getBoolean(k);
break;
case DescValueType.STRINGTYPE:
o[strk] = d.getString(k);
break;
case DescValueType.DOUBLETYPE:
o[strk] = d.getDouble(k);
break;
case DescValueType.UNITDOUBLE:
var uc = new Object;
uc[charIDToTypeID("#Rlt")] = "px"; // unitDistance
uc[charIDToTypeID("#Prc")] = "%"; // unitPercent
uc[charIDToTypeID("#Pxl")] = "px"; // unitPixels
var ut = d.getUnitDoubleType(k);
var uv = d.getUnitDoubleValue(k);
o[strk] = new UnitValue( uv, uc[ut] );
break;
case DescValueType.INTEGERTYPE:
case DescValueType.ALIASTYPE:
case DescValueType.CLASSTYPE:
case DescValueType.ENUMERATEDTYPE:
case DescValueType.LISTTYPE:
case DescValueType.OBJECTTYPE:
case DescValueType.RAWTYPE:
case DescValueType.REFERENCETYPE:
default:
throw( new Error("Unsupported type in descriptorToObject " + t ) );
if (undefined != f) {
o = f(o);
// Function: preProcessExportInfo
// Usage: convert Photoshop enums to strings for storage
// Input: JavaScript Object of my params for this script
// Return: JavaScript Object with objects converted for storage
function preProcessExportInfo(o) {
o.tiffCompression = o.tiffCompression.toString();
o.pdfEncoding = o.pdfEncoding.toString();
o.targaDepth = o.targaDepth.toString();
o.bmpDepth = o.bmpDepth.toString();
return o;
// Function: postProcessExportInfo
// Usage: convert strings from storage to Photoshop enums
// Input: JavaScript Object of my params in string form
// Return: JavaScript Object with objects in enum form
function postProcessExportInfo(o) {
o.tiffCompression = eval(o.tiffCompression);
o.pdfEncoding = eval(o.pdfEncoding);
o.targaDepth = eval(o.targaDepth);
o.bmpDepth = eval(o.bmpDepth);
return o;
// Function: StrToIntWithDefault
// Usage: convert a string to a number, first stripping all characters
// Input: string and a default number
// Return: a number
function StrToIntWithDefault( s, n ) {
var onlyNumbers = /[^0-9]/g;
var t = s.replace( onlyNumbers, "" );
t = parseInt( t );
if ( ! isNaN( t ) ) {
n = t;
return n;
// End X2L.jsxI have put the like var exportPath = "~/Desktop/Backdrops/png/"; and have removed the exportPath = exportPath + '/layers';
but when i run the script it still comes up with the error
could not complete action since the destination folder does not exist
if you are using the extendedscript toolkit would be able to run the script and see if you know were the problem is coming from i cant seem to understand why its not seeing the destination.
thanks for all your help
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
//=================================================================
// Globals
//=================================================================
var exportPath = "~/Desktop/Backdrops/png/";
// UI strings to be localized
var strTitle = localize("$$$/JavaScripts/X2L/Title=X2L");
var strButtonRun = localize("$$$/JavaScripts/X2L/Run=Run");
var strButtonCancel = localize("$$$/JavaScripts/X2L/Cancel=Cancel");
var strHelpText = localize("$$$/JavaScripts/X2L/Help=Please specify the format and location for saving each layer as a file.");
var strLabelDestination = localize("$$$/JavaScripts/X2L/Destination=Destination:");
var strButtonBrowse = localize("$$$/JavaScripts/X2L/Browse=&Browse...");
var strLabelFileNamePrefix = localize("$$$/JavaScripts/X2L/FileNamePrefix=File Name Prefix:");
var strCheckboxVisibleOnly = localize("$$$/JavaScripts/X2L/VisibleOnly=&Visible Layers Only");
var strLabelFileType = localize("$$$/JavaScripts/X2L/FileType=File Type:");
var strCheckboxIncludeICCProfile = localize("$$$/JavaScripts/X2L/IncludeICC=&Include ICC Profile");
var strJPEGOptions = localize("$$$/JavaScripts/X2L/JPEGOptions=JPEG Options:");
var strLabelQuality = localize("$$$/JavaScripts/X2L/Quality=Quality:");
var strCheckboxMaximizeCompatibility = localize("$$$/JavaScripts/X2L/Maximize=&Maximize Compatibility");
var strTIFFOptions = localize("$$$/JavaScripts/X2L/TIFFOptions=TIFF Options:");
var strLabelImageCompression = localize("$$$/JavaScripts/X2L/ImageCompression=Image Compression:");
var strNone = localize("$$$/JavaScripts/X2L/None=None");
var strPDFOptions = localize("$$$/JavaScripts/X2L/PDFOptions=PDF Options:");
var strLabelEncoding = localize("$$$/JavaScripts/X2L/Encoding=Encoding:");
var strTargaOptions = localize("$$$/JavaScripts/X2L/TargaOptions=Targa Options:");
var strLabelDepth = localize("$$$/JavaScripts/X2L/Depth=Depth:");
var strRadiobutton16bit = localize("$$$/JavaScripts/X2L/Bit16=16bit");
var strRadiobutton24bit = localize("$$$/JavaScripts/X2L/Bit24=24bit");
var strRadiobutton32bit = localize("$$$/JavaScripts/X2L/Bit32=32bit");
var strBMPOptions = localize("$$$/JavaScripts/X2L/BMPOptions=BMP Options:");
var strAlertSpecifyDestination = localize("$$$/JavaScripts/X2L/SpecifyDestination=Please specify destination.");
var strAlertDestinationNotExist = localize("$$$/JavaScripts/X2L/DestionationDoesNotExist=Destination does not exist.");
var strTitleSelectDestination = localize("$$$/JavaScripts/X2L/SelectDestination=Select Destination");
var strAlertDocumentMustBeOpened = localize("$$$/JavaScripts/X2L/OneDocument=You must have a document open to export!");
var strAlertNeedMultipleLayers = localize("$$$/JavaScripts/X2L/NoLayers=You need a document with multiple layers to export!");
var strAlertWasSuccessful = localize("$$$/JavaScripts/X2L/Success= was successful.");
var strUnexpectedError = localize("$$$/JavaScripts/X2L/Unexpected=Unexpected error");
var strMessage = localize("$$$/JavaScripts/X2L/Message=X2L");
var stretQuality = localize( "$$$/locale_specific/JavaScripts/X2L/ETQualityLength=30" );
var stretDestination = localize( "$$$/locale_specific/JavaScripts/X2L/ETDestinationLength=160" );
var strddFileType = localize( "$$$/locale_specific/JavaScripts/X2L/DDFileType=100" );
var strpnlOptions = localize( "$$$/locale_specific/JavaScripts/X2L/PNLOptions=100" );
var strPNG8Options = localize("$$$/JavaScripts/X2L/PNG8Options=PNG-8 Options:");
var strCheckboxPNGTransparency = localize("$$$/JavaScripts/X2L/Transparency=Transparency");
var strCheckboxPNGInterlaced = localize("$$$/JavaScripts/X2L/Interlaced=Interlaced");
var strCheckboxPNGTrm = localize("$$$/JavaScripts/X2L/Trim=Trim Layers");
var strPNG24Options = localize("$$$/JavaScripts/X2L/PNG24Options=PNG-24 Options:");
// the drop down list indexes for file type
var png24Index = 7;
main();
// Functions
// Function: main
// Usage: the core routine for this script
// Input: <none>
// Return: <none>
function main() {
if ( app.documents.length <= 0 ) {
if ( DialogModes.NO != app.playbackDisplayDialogs ) {
alert( strAlertDocumentMustBeOpened );
return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
var exportInfo = new Object();
initExportInfo(exportInfo);
// look for last used params via Photoshop registry, getCustomOptions will throw if none exist
try {
catch(e) {
// it's ok if we don't have any options, continue with defaults
try {
var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.
var layerCount = app.documents[docName].layers.length;
var layerSetsCount = app.documents[docName].layerSets.length;
if ((layerCount <= 1)&&(layerSetsCount <= 0)) {
if ( DialogModes.NO != app.playbackDisplayDialogs ) {
alert( strAlertNeedMultipleLayers );
return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
} else {
var rememberMaximize;
var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
app.activeDocument = app.documents[docName];
var duppedDocument = app.activeDocument.duplicate();
duppedDocument.activeLayer = duppedDocument.layers[duppedDocument.layers.length-1]; // for removing
setInvisibleAllArtLayers(duppedDocument);
exportChildren(duppedDocument, app.documents[docName], exportInfo, duppedDocument, exportInfo.fileNamePrefix);
duppedDocument.close( SaveOptions.DONOTSAVECHANGES );
if ( rememberMaximize != undefined ) {
app.preferences.maximizeCompatibility = rememberMaximize;
if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
//alert(strTitle + strAlertWasSuccessful);
app.playbackDisplayDialogs = DialogModes.ALL;
} catch (e) {
if ( DialogModes.NO != app.playbackDisplayDialogs ) {
alert(e);
return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
// Function: settingDialog
// Usage: pop the ui and get user settings
// Input: exportInfo object containing our parameters
// Return: on ok, the dialog info is set to the exportInfo object
function settingDialog(exportInfo) {
return;
// Function: hideAllFileTypePanel
// Usage: hide all the panels in the common actions
// Input: <none>, dlgMain is a global for this script
// Return: <none>, all panels are now hidden
function hideAllFileTypePanel() {
// Function: initExportInfo
// Usage: create our default parameters
// Input: a new Object
// Return: a new object with params set to default
function initExportInfo(exportInfo) {
//exportInfo.destination = new String(exportPath);
exportInfo.fileNamePrefix = new String("untitled_");
exportInfo.visibleOnly = false;
exportInfo.fileType = png24Index;
exportInfo.icc = true;
exportInfo.png24Transparency = true;
exportInfo.png24Interlaced = false;
exportInfo.png24Trim = true;
try {
exportInfo.destination = Folder(new String(exportPath)).fsName; // destination folder
var tmp = app.activeDocument.fullName.name;
exportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf("."))); // filename body part
} catch(someError) {
exportInfo.destination = new String(exportPath);
exportInfo.fileNamePrefix = app.activeDocument.name; // filename body part
// Function: saveFile
// Usage: the worker routine, take our params and save the file accordingly
// Input: reference to the document, the name of the output file,
// export info object containing more information
// Return: <none>, a file on disk
function saveFile( docRef, fileNameBody, exportInfo) {
saveFile(docRef, fileNameBody, exportInfo, false, true);
function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
var id6 = charIDToTypeID( "Expr" );
var desc3 = new ActionDescriptor();
var id7 = charIDToTypeID( "Usng" );
var desc4 = new ActionDescriptor();
var id8 = charIDToTypeID( "Op " );
var id9 = charIDToTypeID( "SWOp" );
var id10 = charIDToTypeID( "OpSa" );
desc4.putEnumerated( id8, id9, id10 );
var id11 = charIDToTypeID( "Fmt " );
var id12 = charIDToTypeID( "IRFm" );
var id13 = charIDToTypeID( "PN24" );
desc4.putEnumerated( id11, id12, id13 );
var id14 = charIDToTypeID( "Intr" );
desc4.putBoolean( id14, interlacedValue );
var id15 = charIDToTypeID( "Trns" );
desc4.putBoolean( id15, transparencyValue );
var id16 = charIDToTypeID( "Mtt " );
desc4.putBoolean( id16, true );
var id17 = charIDToTypeID( "MttR" );
desc4.putInteger( id17, 255 );
var id18 = charIDToTypeID( "MttG" );
desc4.putInteger( id18, 255 );
var id19 = charIDToTypeID( "MttB" );
desc4.putInteger( id19, 255 );
var id20 = charIDToTypeID( "SHTM" );
desc4.putBoolean( id20, false );
var id21 = charIDToTypeID( "SImg" );
desc4.putBoolean( id21, true );
var id22 = charIDToTypeID( "SSSO" );
desc4.putBoolean( id22, false );
var id23 = charIDToTypeID( "SSLt" );
var list1 = new ActionList();
desc4.putList( id23, list1 );
var id24 = charIDToTypeID( "DIDr" );
desc4.putBoolean( id24, false );
var id25 = charIDToTypeID( "In " );
desc4.putPath( id25, new File( exportPath + "C:/Users/Tim/Desktop/Backdrops/png/" + fileNameBody + ".png") );
var id26 = stringIDToTypeID( "SaveForWeb" );
desc3.putObject( id7, id26, desc4 );
executeAction( id6, desc3, DialogModes.NO );
// Function: zeroSuppress
// Usage: return a string padded to digit(s)
// Input: num to convert, digit count needed
// Return: string padded to digit length
function zeroSuppress (num, digit) {
var tmp = num.toString();
while (tmp.length < digit) {
tmp = "0" + tmp;
return tmp;
// Function: setInvisibleAllArtLayers
// Usage: unlock and make invisible all art layers, recursively
// Input: document or layerset
// Return: all art layers are unlocked and invisible
function setInvisibleAllArtLayers(obj) {
for( var i = 0; i < obj.artLayers.length; i++) {
obj.artLayers[i].allLocked = false;
obj.artLayers[i].visible = false;
for( var i = 0; i < obj.layerSets.length; i++) {
setInvisibleAllArtLayers(obj.layerSets[i]);
// Function: removeAllInvisibleArtLayers
// Usage: remove all the invisible art layers, recursively
// Input: document or layer set
// Return: <none>, all layers that were invisible are now gone
function removeAllInvisibleArtLayers(obj) {
for( var i = obj.artLayers.length-1; 0 <= i; i--) {
try {
if(!obj.artLayers[i].visible) {
obj.artLayers[i].remove();
catch (e) {
for( var i = obj.layerSets.length-1; 0 <= i; i--) {
removeAllInvisibleArtLayers(obj.layerSets[i]);
// Function: removeAllEmptyLayerSets
// Usage: find all empty layer sets and remove them, recursively
// Input: document or layer set
// Return: empty layer sets are now gone
function removeAllEmptyLayerSets(obj) {
var foundEmpty = true;
for( var i = obj.layerSets.length-1; 0 <= i; i--) {
if( removeAllEmptyLayerSets(obj.layerSets[i])) {
obj.layerSets[i].remove();
} else {
foundEmpty = false;
if (obj.artLayers.length > 0) {
foundEmpty = false;
return foundEmpty;
// Function: zeroSuppress
// Usage: return a string padded to digit(s)
// Input: num to convert, digit count needed
// Return: string padded to digit length
function removeAllInvisible(docRef) {
removeAllInvisibleArtLayers(docRef);
removeAllEmptyLayerSets(docRef);
// Function: exportChildren
// Usage: find all the children in this document to save
// Input: duplicate document, original document, export info,
// reference to document, starting file name
// Return: <none>, documents are saved accordingly
function exportChildren(dupObj, orgObj, exportInfo, dupDocRef, fileNamePrefix) {
for( var i = 0; i < dupObj.artLayers.length; i++) {
if (exportInfo.visibleOnly) { // visible layer only
if (!orgObj.artLayers[i].visible) {
continue;
dupObj.artLayers[i].visible = true;
var layerName = dupObj.artLayers[i].name; // store layer name before change doc
var duppedDocumentTmp = dupDocRef.duplicate();
if ((png24Index == exportInfo.fileType)||(png8Index == exportInfo.fileType)) { // PSD: Keep transparency
removeAllInvisible(duppedDocumentTmp);
//PNGFileOptions
if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
app.activeDocument.trim(TrimType.TRANSPARENT);
} else { // just flatten
duppedDocumentTmp.flatten();
// Edit
var docName = app.activeDocument.name;
// For some reason indexOf fails if we include the '-', so we use 'copy' and decrement the index by 1.
docName = docName.slice(0, docName.indexOf('copy')-1);
var fileNameBody = (docName+'_'+layerName).toLowerCase();
fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|]/g, "_"); // '/\:*?"<>|' -> '_'
if (fileNameBody.length > 120) {
fileNameBody = fileNameBody.substring(0,120);
saveFile(duppedDocumentTmp, fileNameBody, exportInfo);
duppedDocumentTmp.close(SaveOptions.DONOTSAVECHANGES);
dupObj.artLayers[i].visible = false;
for( var i = 0; i < dupObj.layerSets.length; i++) {
if (exportInfo.visibleOnly) { // visible layer only
if (!orgObj.layerSets[i].visible) {
continue;
var fileNameBody = fileNamePrefix;
fileNameBody += "_" + zeroSuppress(i, 4) + "s";
exportChildren(dupObj.layerSets[i], orgObj.layerSets[i], exportInfo, dupDocRef, fileNameBody); // recursive call
// Function: objectToDescriptor
// Usage: create an ActionDescriptor from a JavaScript Object
// Input: JavaScript Object (o)
// object unique string (s)
// Pre process converter (f)
// Return: ActionDescriptor
// NOTE: Only boolean, string, number and UnitValue are supported, use a pre processor
// to convert (f) other types to one of these forms.
// REUSE: This routine is used in other scripts. Please update those if you
// modify. I am not using include or eval statements as I want these
// scripts self contained.
function objectToDescriptor (o, s, f) {
o = {};
var d = new ActionDescriptor;
var l = o.reflect.properties.length;
d.putString( app.charIDToTypeID( 'Msge' ), s );
for (var i = 0; i < l; i++ ) {
var k = o.reflect.properties[i].toString();
if (k == "__proto__" || k == "__count__" || k == "__class__" || k == "reflect")
continue;
var v = o[ k ];
k = app.stringIDToTypeID(k);
switch ( typeof(v) ) {
case "boolean":
d.putBoolean(k, v);
break;
case "string":
d.putString(k, v);
break;
case "number":
d.putDouble(k, v);
break;
default:
if ( v instanceof UnitValue ) {
var uc = new Object;
uc["px"] = charIDToTypeID("#Rlt"); // unitDistance
uc["%"] = charIDToTypeID("#Prc"); // unitPercent
d.putUnitDouble(k, uc[v.type], v.value);
} else {
throw( new Error("Unsupported type in objectToDescriptor " + typeof(v) ) );
return d;
// Function: descriptorToObject
// Usage: update a JavaScript Object from an ActionDescriptor
// Input: JavaScript Object (o), current object to update (output)
// Photoshop ActionDescriptor (d), descriptor to pull new params for object from
// object unique string (s)
// JavaScript Function (f), post process converter utility to convert
// Return: Nothing, update is applied to passed in JavaScript Object (o)
// NOTE: Only boolean, string, number and UnitValue are supported, use a post processor
// to convert (f) other types to one of these forms.
// REUSE: This routine is used in other scripts. Please update those if you
// modify. I am not using include or eval statements as I want these
// scripts self contained.
function descriptorToObject (o, d, s, f) {
var l = d.count;
if (l) {
var keyMessage = app.charIDToTypeID( 'Msge' );
if ( d.hasKey(keyMessage) && ( s != d.getString(keyMessage) )) return;
for (var i = 0; i < l; i++ ) {
var k = d.getKey(i); // i + 1 ?
var t = d.getType(k);
strk = app.typeIDToStringID(k);
switch (t) {
case DescValueType.BOOLEANTYPE:
o[strk] = d.getBoolean(k);
break;
case DescValueType.STRINGTYPE:
o[strk] = d.getString(k);
break;
case DescValueType.DOUBLETYPE:
o[strk] = d.getDouble(k);
break;
case DescValueType.UNITDOUBLE:
var uc = new Object;
uc[charIDToTypeID("#Rlt")] = "px"; // unitDistance
uc[charIDToTypeID("#Prc")] = "%"; // unitPercent
uc[charIDToTypeID("#Pxl")] = "px"; // unitPixels
var ut = d.getUnitDoubleType(k);
var uv = d.getUnitDoubleValue(k);
o[strk] = new UnitValue( uv, uc[ut] );
break;
case DescValueType.INTEGERTYPE:
case DescValueType.ALIASTYPE:
case DescValueType.CLASSTYPE:
case DescValueType.ENUMERATEDTYPE:
case DescValueType.LISTTYPE:
case DescValueType.OBJECTTYPE:
case DescValueType.RAWTYPE:
case DescValueType.REFERENCETYPE:
default:
throw( new Error("Unsupported type in descriptorToObject " + t ) );
if (undefined != f) {
o = f(o);
// Function: preProcessExportInfo
// Usage: convert Photoshop enums to strings for storage
// Input: JavaScript Object of my params for this script
// Return: JavaScript Object with objects converted for storage
function preProcessExportInfo(o) {
o.tiffCompression = o.tiffCompression.toString();
o.pdfEncoding = o.pdfEncoding.toString();
o.targaDepth = o.targaDepth.toString();
o.bmpDepth = o.bmpDepth.toString();
return o;
// Function: postProcessExportInfo
// Usage: convert strings from storage to Photoshop enums
// Input: JavaScript Object of my params in string form
// Return: JavaScript Object with objects in enum form
function postProcessExportInfo(o) {
o.tiffCompression = eval(o.tiffCompression);
o.pdfEncoding = eval(o.pdfEncoding);
o.targaDepth = eval(o.targaDepth);
o.bmpDepth = eval(o.bmpDepth);
return o;
// Function: StrToIntWithDefault
// Usage: convert a string to a number, first stripping all characters
// Input: string and a default number
// Return: a number
function StrToIntWithDefault( s, n ) {
var onlyNumbers = /[^0-9]/g;
var t = s.replace( onlyNumbers, "" );
t = parseInt( t );
if ( ! isNaN( t ) ) {
n = t;
return n;
// End X2L.jsx -
HOW TO SAVE A TEXT FILE ON AL11
HOW CAN WE SAVE A TEXT FILE ON THE APPLICATION SERVER AL11 WHICH IS ON THE DESKTOP OR ANY DRIVES.
CAN SOME ONE GIVE ME THE STEP BY STEP PRCEDURE
REWARDS IF USEFULHi,
Use Tcode CG3Z to upload files to application server and use tocde CG3Y to download file to your desktop.
Reward points if helpful.
Regards,
CS. -
How to save images as png or jpg?
Hi!
I just made a picture in the new photoshop cs6 beta and I want to save it in the png or jpg file-format, but there isn`t any possibility I found to save it. In tha Save As-Dialog there are just seven possibilities to save. Without png and jpg.
Thanks.
Screenshot:
Ps: I`ll like to save it in the icon (*.ico) format. Is that possible?You're confusing the total number of bits (8 bits of RGB+Transparency = 32 bits, a misleading number), with the bits per channel (32 bit floating point, which makes RGB+T = 128 bits total).
32 bit PNG is a nomenclature that needs to go away - the number could mean 1 channel at 32 bits/channel, 2 channels of 16 bits each, or 4 channels of 8 bits each. (or more if PNG supported more bit depths)
In Photoshop, you're using bits per channel. You want 8 bits per channel, not 32. -
How to save an excel file as CSV with semi-colon as data separator?
We are creating a flat data file to load the flat file data to our BW system with Excel. When we save the file, there are three kinds of CSV types for selecting from the "Save as type" list box:
CSV (Comma delimited)
CSV (Macintosh)
CSV (MS-DOS)
There is no CSV (semi colon delimited) type. If we pick CSV (Comma delimted) as the type, then when clicking the "Preview ..." picture icon under the "DataSource/Trans. Structure" tab of the InfoSource for this flat file (with the CSV radio button checked the Data separator default is ";"), the File Upload Preview window shows the data is messed up that some columns of the excel flat file are combined into one column.
Since the save type we picked is "CSV (Comma delimited)", then we try to change the default Data separator from ";" to "," in the preview selection screen, but still not helpful!
How to resolve the above problem?
ThanksHi Kevin,
This "," is defined in your windows setting. If you want to have ";" as separator then go to control Panel, select Regional Options, go to Numbers Tab and define the List separator as ";". After that when you will save your excel file as CSV(MS-DOS) it will have ";" as separator. This will make sure that the amounts are not broken in to two different fields while loading.
Else if you keep "," as separator then you can also go into the Excel and define all number fields as Number without thousand separator.
Let me know if you have any doubts in this.
Regards,
Rohit
Maybe you are looking for
-
How do I transfer projects from one disk to another disk?
I just installed Windows 7 on a second drive in my computer (XP on the original disk). My previous projects were all created on the XP disk on PE 2. I want to move all that work into the Windows 7 environment, and run there from now on with Premier
-
I've been using my old ipod touch for years and never had a problem with syncing. However, now with the 12.1 itunes it won't even recognize that I plugged in a device and won't show up in itunes. The Ipod would charge but it could not be connected to
-
PATH and LD_LIBRARY_PATH on Linux
Hi I want to run an executable within a java program, since the executable requires certains dirs in its PATH, i need to set the PATH and LD_LIBRARYPATH. I am not sure how to set the LD_LIBRARY_PATH since i dont know what the system property name for
-
I'm a new user in the jdeveloper community :) i want to debug a bpel process ,for example the "AmazonFlow" sample project. but it asking for a "default run target" path, what kind of a file it expect? i guess it's a kind of a file that consume input
-
Md_restore doesn't work
Hello everyone, I was testing md_backup and md_restore commands in 11g R1 on my test system. I backed up the metadata using md_backup and intentionally crashed one of my disks to simulate the disk crashed. Then I restarted the ASM instance but instan