Home Technical Talk

Ever wanted to save out your Diff,Spec,Norm... from a PSD with a single button push?

polycounter lvl 14
Offline / Send Message
d1ver polycounter lvl 14
Hey, what's up guys!
Is anyone here as annoyed as I am about having to waste time to save out files from Photoshop In a boring tedious way many times a day?
Poops solution about making "actions" is nice, but unfortuantely wasn't working for me, since I could be having a number of projects rollin' simultaniously and I was just too lazy to redo the "actions" 5 times a day - everytime some feedback comes.

vTools didn't work out because It simply hides all the layergroups except for the one you are about to save. And I have my specular as a set of Adjustment layers over the diffuse.=(

I haven't found much alternatives, though I didn't look much.( it'd be fun if there is XD )

So the other day I snapped=) I needed a clean simple little thing to save out my files for me, that changed nothing and asked nothing - no prefernces, checkboxes and any other stuff like that. The most userfriendly program is the one you don't even notice. Just push a button.

After some hours of shaman singing I came up with a little something, and here it is:
d1vsavearchvive.jpg

Here's a small readme commented into the script itself. Even though I find the picture more informative it misses some small points, that might be worth knowing for someone:
Hi,there.
This script saves a copy of your document with a specified postfix in the same folder as your current PSD without any additional stress.
Just a single push of a button. It is plain and simple. Exactly what I find most usefull.
You file is saved as it is, as you see it in front of you. The script doesn't switch visibility of any layers or groups or change anything at all.

How to use it:
- Create a document. For example "Test.PSD"
- Group layers.
- Mark groups that define separate files with "< "(dont forget " " - space after the "<").
For exmaple, among other groups in your file you could have:
"< Normal"
"< Specular"
"< Diffuse"
- Create awesome art
- Then, for exmaple, when you want your Normals to be saved into a separate file, you make the normals group visible and run the script.
The script will save the copy of your current document appending the first letter of the "toppest", visible, marked group:
"Test_N.jpg" - in this case.
If there are no groups marked or no groups at all, then the copy will be saved with the same name as the PSD.

Be carefull! Remember what you see is what you save. The script doesn't save only "< Normal" group. It saves the file exacly as you see it.

ALPHA CHANNEL: Unfortunately JPEG doesn't support alpha channels, so the script won't save it for obvious reasons.
To save a TGA file with alpha, you'll have to mark the appropriate group with a "*" at the end of the groups name. The script will save a
.tga file with first 4 channels you have in your channel stack. Everything else will be discarded.

Cheers! =)

JPEG and TGA

The script has two versions - JPEG and TGA. Why?
TGA - is the most commonly used format for textures and stuff(that supports alpha channles), but
JPEG is a lot smaller memory wise and I haven't ever met a person who could tell the difference between a TGA file and a maximum Quality JPG. So for previewing I always use JPG since it causes less stress for my PC with no visible quality loss. I even done numerous freelance gigs, where the client accepted jpeg as final result for their textures. But you do have to keep an original loseless variant of your work, though.

Testing

I tested the script on myself for a couple of days and everything was silky smooth. I didn't work much with an alpha though.

Anyways, I am the lousiest java programmer you ever seen and never before in my life have I seen java scripting language before I sat down doing this thing the other day.
So If you'd keep an eye out for bugs - that'd be really nice of you. Feel free to post 'em here and I'll see what I can do.

It's only been tested with Photoshop CS 3, but there are no incompatibilities with other versions, that I know of.

Hotkeying
There's a little strange thing I've noticed when tryin to hotkey this script. I wanted a key somehow associated with "ctrl + s". The only available variant was "ctrl + alt + s". But! ExtendScript Toolkit 2(where you write scripts) has the same hotkey bind to "Scripts" window, so sometimes when you run your script from photoshop with this button combintaion it opens ExtendScript Toolkit. Even when you unbind this combination in ExtendScript Toolkit it still does. It has nothing to do with the script and with another hotkey it works perfectly fine.

Epilogue
Anyways, I hope you guys might find this thig usefull too and It will get a little boredom out of your day leaving you more time for art!=)
It actually just feels good saving out stuff and not having to do it the long way.)

cheers and have a nice sunday!(I'm sure as hell going to enjoy mine =) )
c ya

Replies

  • JohnnySix
    Offline / Send Message
    JohnnySix polycounter lvl 16
    Wow, I didn't know you could save stuff inside a .jpg before!

    The script sounds very helpful, I'll give it a whirl later today.

    For the sake of the convenience of being able to double click to open it, maybe a .zip download could be offered too, just for those using the native windows zip functionality.
  • Nysuatro
  • zOffTy
    Offline / Send Message
    zOffTy polycounter lvl 16
    d1ver, nice script, easy to use! works fine on CS2
  • Yozora
    Offline / Send Message
    Yozora polycounter lvl 11
    hmm shouldn't it save the psd as well as making a new tga?

    I was using the uv toggle by funkybunnies, but yours is smaller (and therefore more efficient? I dont know :p)
    Funkybunnie's one usually lags a couple of secs on the first attempt but after that, it toggles on/off instantly. Your one seems to skip the laggy first attempt which is nice.

    Only problem is your one is case-sensitive, and all my previous uv layers were called "uv". Not a big deal of course since I can just adopt to use "UV" from now on~

    Thanks for the scripts, I'll try it out a bit more to see if I find any problems/improvements :p by the way I can confirm it works on CS4 too.



    edit: just tested it on a group that doesnt have a < in front, and nothing happened? It went through the whole zoom out and zoom back in thing like it was saving out a tga, but it didnt actually save anything...

    Speaking of the whole "zoom out and zoom in" thing, can that be disabled? I used to use photoshop actions for saving my tgas, and each time I use them it didnt do this zooming stuff... its a bit disorienting because previously I could press my save action and almost instantly continue working where I left off, but with your script I have to wait for it to zoom back in to where I was. Its only like 1 sec, but still :p

    edit#2; Actually I just made an action for Save + running this script, and its much faster (+1-2 secs) to not save the psd each time you make a tga... Probably best to not combine them then. Thanks for making me realize this :p
    And thats one of the main reasons I dont like the scripts that save out multiple files at once, because most the time you'll only be working on 1 file and its just unneccessary to save all the different groups at once.
  • zOffTy
    Offline / Send Message
    zOffTy polycounter lvl 16
    Yozora, "UV" or "uv" works well on my CS2

    if I put my uv layer in a group, it's didn't works. Is it possible to add this little feature?:D
  • Yozora
    Offline / Send Message
    Yozora polycounter lvl 11
    zOffTy wrote: »
    Yozora, "UV" or "uv" works well on my CS2

    if I put my uv layer in a group, it's didn't works. Is it possible to add this little feature?:D

    Just quadruple-checked, it definitely does not recognize "uv" for me, while using CS4. This applies to both groups and layers.
  • Eric Chadwick
    Where is your script?
  • Yozora
    Offline / Send Message
    Yozora polycounter lvl 11
    Where is your script?

    open his .jpg with winrar, or rename the jpg to .rar
  • Bal
    Offline / Send Message
    Bal polycounter lvl 17
    I've been using Qsave for the last few months, works fine to save out all my maps instantly, combined with a simple photoshop action (where I Isolate each group one by one).
    http://www.polycount.com/forum/showthread.php?t=68118

    Will try this one out later.
  • Eric Chadwick
  • d1ver
    Offline / Send Message
    d1ver polycounter lvl 14
    Hey,JohnnySix, looking forward to hearing what you'll have to say)

    Yeah the RarJpg thing is pretty fun. Here's a little manual on how to do that.
    I would love to save a .zip version too, but unfortunately have nowhere to upload it. I'm planning on launching my site sometime mid-summer and I'll definetly put it there.

    Nysuatro, yeah something like this! Even though mine has less functionality or less excessive features, depending on what you expect from it=) It is obvious, that everyone, who has written that sort of a script made It to their liking and it's nice that you guys have something to choose from.)

    My point here is maximum functionality with less to none interface. I personally find my scipt easier to use, for there's only one button to push. And you save all the kinds of files with or without alpha, simply following a litle naming convetion.

    Hey,zOffTy,thanks a lot, I'm glad you like it! It's somewhat heartwarming, knowing your sruff is usefull to other people=)

    Thanks finding that little bug with UV being in a group! Yeah it's totally possible to fix this. But. I have a little question for you, though. Under what circumstances you need to have your UV layer in a group?

    You see, my UV saving code is as simple as it gets) It just blindfires to toggle the visibility on "UV" layer. And if there is none, then I catch it before the error report pops out.
    When you want to have it in a group the script has to check every group and every group in this group and so on. And I don't know if it's nescessery.

    here's a little code I made just now that will toggle UV layer visibility when it's in a group. But not in a sub group.) Just replace the original UV file with this in notepad and everything should work fine.
    // (c) Copyright 2010. Andrew Maximov. All rights reserved.

    if (documents.length == 0) {
    alert("There are no documents open.");
    }
    else {

    var UVisPresent = 0,a = 0,i = 0;

    try{
    activeDocument.layers["UV"]
    UVisPresent++;
    }
    catch(b){
    while (a <= activeDocument.layerSets.length-1)
    {
    try{
    activeDocument.layerSets[a].layers["UV"]
    i = a;
    break;
    } catch( b ){ }
    a++;
    }
    }
    if(UVisPresent)
    activeDocument.layers["UV"].visible = !activeDocument.layers["UV"].visible;
    else
    if(a <= activeDocument.layerSets.length-1)
    activeDocument.layerSets.layers["UV"].visible = !activeDocument.layerSets.layers["UV"].visible ;
    else
    alert("There's no UV layer in the document.\nOr it is stored in a subgroup.\n", "Can't Find UV");
    }

    But I don't know if I want to edit the original script this way. I added a warning about it instead(edited original post), so people might know, what's going on. And drag out their UV layer if it's hiding somewhere.) I find it a more rational solution now, but feel free to correct me.

    Yozora, you're welcome, pal!
    Yeah, I didn't want to save PSD too. Mine are ususally close to 200mb closer to an end, and saving it sometimes takes a while. Or even a whole minute. So I thought I just give you guys your freedom to save whenever you like and exactly whatever you like without forcing you into anything else.

    With the UV name, well, basically yeas, I just had to choose something. Since lots of people use lots of different names for their unwrapped wireframe layers like UV,uv,wires,wz or unwrap. I just decided on "UV".=)

    The zoom-in zoom-out thing is not what it seems actually. I actually create a flattened copy of the current document to work with. I tried doing it in the .psd and then undoing things back, but found it less practical. So I guess the flickering is the one thing you'll have to get over with. Sorry.

    You sure about the not marked groups thing? It is supposed to save your file with the exact same name as .psd. For example if you had Test.psd you'd get Test.tga or Test.jpg. Maybe such a file was already present, so you didn't see no cahnges? If no then if you could provide a screen of your .psd folder and your layer stack - it would be very helpfull.
    Strange though, 'cause it works totally fine with me.

    EricChadwick,hey, thank you very much for putting it in the wiki,man! I hope more people will find this thingy now!

    Anywa,y thanks a lot guys for all your feedback and nighty night!=)
  • zOffTy
    Offline / Send Message
    zOffTy polycounter lvl 16
    thanks d1ver!
    Actually I just put my uv layer in a group "HIDE-ME" because I'm using some Photoshop Actions and it need to have same hierarchy

    no I don't forgot some uv layer here and there :p
  • Yozora
    Offline / Send Message
    Yozora polycounter lvl 11
    d1ver wrote: »
    You sure about the not marked groups thing?....

    I just tested it now on a different file and it worked fine. And then re-tested it with the same file as last time and it also worked... Not sure why it wasnt working before, maybe I was just being blind :s But the folder I tested it on was practically empty... it would be impossible to miss it :(
    Lets blame..... lack of sleep!
  • Avanthera
    Offline / Send Message
    Avanthera polycounter lvl 10
    This looks great!
    I have been redoing actions for i don't know how long, this definitely speeds things up.
    Thanks
  • d1ver
    Offline / Send Message
    d1ver polycounter lvl 14
    I gotcha,zOffTy, thanks for sharing=). So, did you try the code for the layer being inside a group? No bugs yet?)
    Yozora,'cmon, no need to blame anyone) as long as it's working I'm happy. Thanks for clearing this out!

    Hey,shrew81, you're welcome!)
  • zOffTy
    Offline / Send Message
    zOffTy polycounter lvl 16
    Yes thanks d1ver!
    works perfect for me ! :)
  • Yozora
    Offline / Send Message
    Yozora polycounter lvl 11
    Just a note; I hotkeyed this script to ctrl+shift+S, and then put ctrl+shift+S onto one of my mouse buttons using setpoint/uberoptions.
    If I hold alt + ctrl + shift + S, nothing happens in photoshop.
    But if I hold alt and use my mouse hotkey, it will crash photoshop. Tried it many times and it consistently crashes.

    This is amazing because I've never been able to consistently crash photoshop before, in fact I've rarely even seen it crash ever.

    I fixed it by binding this script to "F2" instead. Now if I alt+F2 on my keyboard , nothing happens and if I alt +(F2 bounded on mouse key), it no longer crashes, yay :p


    edit: The "lag on first attempt of using the toggle uv button" thing that I was talking about earlier happens with your script too. Oh well, guess its unavoidable then!
  • pasha_sevez
    Offline / Send Message
    pasha_sevez polycounter lvl 13
    d1ver , great thanks! It is what i was looking for a long time! Works just charming - exactly what I need! Thank you very much again! Hoping you will keep on updating these scripts )))
  • Thall
    Offline / Send Message
    Thall polycounter lvl 5
    Image/script link broken?
  • Zezeri
    Sounds really nice, gonna give it a try :)

    Would be cool to have a tiff option for cryengine!
Sign In or Register to comment.