Home Technical Talk

Need help with the photoshop batch

polycounter lvl 6
Offline / Send Message
rorozilla polycounter lvl 6
hiya everybody,

i'm want to save a bunch of files in PNG-24 safe for web for a little game we are making. I open one of the files of the batch i want to work on, set up my action by pressing the record button> save> safe for web>png-24>stop button.

but as soon as i ask photoshop to start the batch, it saves them in the folder i asked it to, but the only file that actually saved in safe for web, is the one I initial worked on to set up my action... I can tell because the file size is cut by half...

so what am I supposed to do? Am i missing a step? I looked on the net but everybody that made batches in safe for web don't seem to have the same problem as me.

you guys would really save my bottom by helping me! I really don't want to resort to saving them one by one... that would suck!

PS: I am using Photoshop CS4 by the way, if that helps in anyway.

Thanks to all of you in advance!! :D

Replies

  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    Have you tried to make a photoshop script instead of an action? I'm pretty sure this can be done quite easily. I can help you out if you like?
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    You have to check "Override Action "Save As" Commands" in the Batch options.
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    Noors: i just tried it, and it just doesn't save my files at all! which would make sens, since I'm overwriting the save... this is really boggling my mind... why would it not register in my action... i can see that it saves and everything, but its more of a copy then a save in a new format.

    CW: that would be very nice of you! i have no clue of as how the Photoshop scripts work, so if you could point me in the right direction, you would be saving my butt!

    thanks so much guys for your responses! I hope ill find a solution soon, or else I'm gonna have to save them all one by one... and that would really be shitty... :C
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    whoo ho!! i fixed it!! i don't exactly know how, but i got it working, so I'm pretty happy, i think its because i created a folder in my action, so that all my files could end up in it. it makes it so that i have to remake an action with a new destination folder every time i have a different animation to save, but at least its as a lot easier then saving a 100 frames one by one!


    Thanks to all of you guys for helping me!! :D
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    I've always got annoyed with actions wanting to save in annoying locations, so I just make scripts to cover whatever we need at work.

    If you wanted I can take a look at this for you. You would run the action, the action would run the script, the script would prompt you for a folder, then the script would go ahead and save the folder contents as png in some other place, either a subfoder or something of your preference.

    Glad you have it working now though. :)
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    I'm am still very interested in learning about scripts, i never thought there where any for Photoshop until today, is it hard?

    If you happen to have a really nice tutorial, or if you feel like running me trough the basics, i would be really eager to learn! anything that can help me up my productivity is what i need!


    Thank you so much for everything!! I'm really looking forward to learning!
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    ok, well the documentation for photoshop scripting is not the most user friendly (at least for a numpty like me) but there are sites like PS-Scripts and generally googling will turn up results. The docs are in the the photoshop folder there are some pdfs with the various classes and so on which the photoshop scripting exposes. You can do most things in script. We have made tools to extract and restitch big textures, speed up exporting textures from a single psd by exporting layers / layer groups - all sort of things.

    Anyway, after 30 mins of cut and pasting old scripts + internet/doc examples:
    ////////////////////////////////////
    //file saver script
    // by wallasaurus :)
    ////////////////////////////////////
    
    // save options
    var pngOpts = new ExportOptionsSaveForWeb; 
    pngOpts.format = SaveDocumentType.PNG
    pngOpts.PNG8 = false; 
    pngOpts.transparency = false; 
    pngOpts.interlaced = false; 
    pngOpts.quality = 100;
    
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    
    //pick folder to process
    
    var inputFolder = Folder.selectDialog("Select a folder to process");
        if (inputFolder == null)
            throw "No input folder chosen";
    
    //get files in folder
    
    var fileList = inputFolder.getFiles("*.*");
    
    
    //iterate files
    
    for (var i = 0; i < fileList.length; i++) {
            // Only want to open non-hidden files (and no folders)
            if ((fileList[i] instanceof File) && (fileList[i].hidden == false)) {
                // Open the file in Photoshop
                var docRef = open(fileList[i]);
                if (docRef == null)
                    throw "the document is not valid";
                
                //alert(docRef.name);
                //pick apart filename
                var pieces = docRef.name.split('.');
                var filename = (pieces[0])+".png";
    
                filename_only = filename;
                //alert(filename_only);
                
                // save out png file
                saveFile = new File(inputFolder+"/"+filename);
                //alert(saveFile);
                activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);    
                docRef.close(SaveOptions.DONOTSAVECHANGES);
                }
            }
    
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////
    

    if the output format is wrong, let me know, and it can be tweaked (or tweak it yourself if you like!) :D

    Feel free to experiment with this for other things, I found the best way to get into the scriptnig wa to just do some things.
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    Thank you so much! Heheh I have to say, I am a bit lost, I dont seam to understant how to get the script into photoshop, is this java, apple or VBScript? and dos it actulay make a difference which scripting language you us?

    Heheh i am completely new to script so I'm missing a lot of the basic stuff, it seams pretty logical thaught and I think ill get the hang of it quickly, i just neet to start at the beginning.


    I'm looking into it right now, on how to get your script into Photoshop, but if you happen to have time to explain it to me, i would greatly appreciate it!


    Thank you so much for all the help you have given to me already! You are really a life saver!
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    oh yeah, i totally forgot that part!

    1) copy that text to a notepad file.
    2) save the file somewhere with a name "myscript.jsx" it is javascript so needs jsx extension.
    3) in shop, make an action, record-
    4) file menu > scripts > browse >
    5) pick the file you saved, it will run the script, so pick the folder and wait for it to do its thing.
    6) stop the action, save it if you like for later. :)

    hope that helps, seems fiddly but it's not realy too hard once you get the hang of it. Usually kind TAs will sort it all and you just get a new action in pshop to run. :)
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    So if I understand correctly, you use as mix of scripting and actions?

    I figured I needed to use the note pad and actually put the extension, but Photoshop doesn't seem to process it as a Java script file... so i cant see it when its time to select it.

    Do i have to do something special, other then naming it and putting .jsx at the end?


    Thank you so much!!! And I'm so sorry for being such a script noob! I have been postponing to learn it, and now its biting me in the arss pretty hard! but I get the feeling I'm getting close to figuring it out! Thank you so much!
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    make sure notepad doesnt actually name the file blabla.jsx.txt, it can do that sometimes. :) (turn off 'hide known extensions' in the shell.)
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    Thank you so much! that was exactly my problem!!

    I should be able to proceed now, ill try stuff out. when i copy your code, do i past all the slashes into the .JSX?


    I will try with and without, but im just curious if its the kind of thing that's important or if you can actually add artsy stuff that wont be processed as information in the script.
  • rorozilla
    Options
    Offline / Send Message
    rorozilla polycounter lvl 6
    I finally got everything working!! its all thanks to you CW, thank you so much!! I can see how scripting can really make your life easier!! You really saved my life there~!
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    no problem! scripting is fun, ok? (actually it's not really, but it can mean you don't ave to do even *worse* borin stuff over and over!)
Sign In or Register to comment.