Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got a altered version of the standard one (does selective output & artboards & layercomps) #143

Open
schroef opened this issue Mar 24, 2020 · 25 comments

Comments

@schroef
Copy link

schroef commented Mar 24, 2020

I gues you not using the s4w in the exporter because that is faster. Though I wonder, I believe the original uses some parts of it but without a dialog, that's also why its faster. The thing is that the conversion to sRGB takes some times. This is a major slowdown.

ANyways. Im also a graphic design and have been altering the basic version from Photoshop. I found a version which could loop over artboarfs. Though that user had hardcoded many items and also stripped many of the standard stuff.

Ive now altered it and made some more improvements. It now allows you to use layercomps but also artboards. You can also select and layercomp from the export panel. Im still in the process of optimizing it a bit. It currently slows down when you do sRGB. But since I'm a graphic design this is a pre function I need. I don't send anything to clients which is NOT sRGB.

It also can trim transparent layers if needed

Another point why the default version of photoshop is slow. Its being exported while the image is not flattened. Thats the major bottleneck! Ive implemented it that it only saves layers if TIFF or PSD. Also when you need transparency, its not flattened. That also a thing which is broken in the default, I also fixed that

Layer Comps   Artboard To Files_v7_Column Filetype

@schroef
Copy link
Author

schroef commented Mar 24, 2020

Here's a view when layercomps are active. You can choose to either select one, use selected or use all. If you artboards, you can choose all or do a single cardboard. Very handy for UI designers I think.

Layer Comps   Artboard To Files_v12_Column Filetype

@schroef
Copy link
Author

schroef commented Mar 24, 2020

I was also in the process of adding a process bar, did not find the time yet. If you don't mind I have a look at how you did it.

PS did you know of this tool, ScriptUI, it lets you build you panel interface interactively. This man is a GOD and he gave us an awesome tool. Making the panel is a pain in the ass. This thing is so simple and handy!!!
https://scriptui.joonas.me/

Screen Shot 2020-03-24 at 00 39 42

@schroef
Copy link
Author

schroef commented Mar 24, 2020

Holycrap, just test this one. Your GUI could use a lot of work. THis thing is MADNESS hahaha!

@schroef
Copy link
Author

schroef commented Mar 24, 2020

PS is this script really fast? I did a test with a simple document with 3 layers. I also used my version of the layercomp export. The default export layer comps is faster and my version as well..

Do you guys have some kind of document to do speed tests. I did see something about testing speeds. But it didn't see system specs nor did I see a download link for that file.

@antipalindrome
Copy link
Owner

@schroef You're welcome to make any changes you'd like to see. This is a collaborative project.

I wrote the original code almost 9 years ago (before CC even came out!). It would not surprise me if the modern PS export functionality has gotten better over time or that people have better hardware and therefore it's faster. But since then I don't use Photoshop as much anymore so I don't do too much work on this script anymore. But originally what took photoshop ~30 minutes to export (on my hardware at the time) my script took less than 1 minute if I remember correctly.

That being said I know people still use this script these days, so I'm sure it still benefits some people.

@Petermyname
Copy link

Petermyname commented Mar 24, 2020 via email

@Petermyname
Copy link

@schroef I like what you doing. But for this script if you take a closer look you will see the different options offered in terms of Exporting the layers while the layer names are maintained (Very critical) ,...also we have exporting groups as layers, using top layer as foreground or lowest layer as background. This script is not for comparison with what Photoshop can do..but its unique in its own way. Different minds have added some unique features that photoshop hasn't provided yet

@spartacruz
Copy link

@schroef You're welcome to make any changes you'd like to see. This is a collaborative project.

I wrote the original code almost 9 years ago (before CC even came out!). It would not surprise me if the modern PS export functionality has gotten better over time or that people have better hardware and therefore it's faster. But since then I don't use Photoshop as much anymore so I don't do too much work on this script anymore. But originally what took photoshop ~30 minutes to export (on my hardware at the time) my script took less than 1 minute if I remember correctly.

That being said I know people still use this script these days, so I'm sure it still benefits some people.

Hi Hanna @hsw107 !

Just wanna let you know that I fully appreciate your effort to make this happen. I am a bit surprised to know that someone behind this script is a woman engineer.

Me and my co-worker are soooo helped with your script.
I work at one of (could be said) large ecommerce and we have to process lots of photo a day.

Even though this is a collaborative project... Wish you could come back again and maintain this script to be more powerful on CC.

Wish you best of luck, wherever you are.

Regards,
-Yuri

@spartacruz
Copy link

I'm one of those who benefit greatly from this Script. Thanks Hanna for the great concept you came up with and also much appreciation to other developers who have improved on the features of the script

Me too!

@antipalindrome
Copy link
Owner

antipalindrome commented Sep 11, 2020

@spartacruz

Hi Hanna @hsw107 !

Just wanna let you know that I fully appreciate your effort to make this happen. I am a bit surprised to know that someone behind this script is a woman engineer.

Me and my co-worker are soooo helped with your script.
I work at one of (could be said) large ecommerce and we have to process lots of photo a day.

Even though this is a collaborative project... Wish you could come back again and maintain this script to be more powerful on CC.

Wish you best of luck, wherever you are.

Regards,
-Yuri

Hi Yuri,

Thanks for the kind words!

Here are some thoughts ....

The original script was written back before CC existed. I had written it simply to see if I could address the glaring performance issues of the built-in Photoshop script, based on some voiced frustration online.
I had also assumed that with time Adobe itself would "catch up" and have the performance and feature set that this script has, rendering it obsolete. But it sounds like that's not the case, even today.

I used to be much more involved in the graphic design sphere, and used to use photoshop almost daily. Nowadays I'm afraid I use it at most maybe once a month, so personally I've definitely drifted away quite a bit, though I do still write code professionally.

It's also hard for me to know how to best move this script forward without potentially alienating those who never moved on to CC and still rely on CS versions, though perhaps that's less important these days (I myself gave up using CS6 and moved to CC). Maybe the best thing here is to still leave the current version available, but move on and focus more on CC with future work.

But I'd also like to mention that some of the best work and features on this script have been made by other contributors over the years who've done some truly outstanding work, and I'm super thankful to them!

That being said, it seems like many people still use this script so many years later, and I really appreciate that. So while I don't want to make any promises, I would like to pick this up and try to get to some features in for everyone who relies on it!

Hanna

@schroef
Copy link
Author

schroef commented Sep 12, 2020

Yeah this script is really different Vs the main export ones from ps. I think ps also a has a script for exporting layers, they also have their app which does it live.

I was mainly interested in the progress bar. I didnt get this version working but did found a different one. The issue with progress bars is that some of the code doesn't work properly or the same on other OS's. Second thing is, showing a progress bar slows down the process significant.

I've been updating this add-on animdessin2 and added a feature that the user could make adjustments on all selected layers Vs doing each one by one manually. I've tried a couple different approaches to using a progress bar. Since I develop on Mac and not the newest ps version, I noticed many flaws in the code. This seems to be known and is limition of the code. Lots of the code or jsx language is quite outdated, badly documented etc etc.

My implementation now is, only show a progress bar abox X-amount of layers and only update it every 5 layers. The redraw takes to much of a hit on the speed.

Feedback is nice but I get like 1/5 of Total time speedup by not showing it. But sometimes it nice to see what's going on. Otherwise it looks like ps is not responding

@antipalindrome
Copy link
Owner

I played around with not showing the progress bar but was unable to get any meaningful performance gains. But maybe I forgot to take the key part out? Would be curious to know what you did to get a performance gain as I'd love to have the script be as efficient as possible!

@schroef
Copy link
Author

schroef commented Oct 28, 2021

@hsw107

on what OS are you developping?

Well i got mixed results. The issue is, progressbar on OSX is kinda crappy, doesnt update properly. So i let it update only about X amount time, so in steps. I also only use it, when there are many layers used. But for my version of layercomps & artboards exporter, i let it out. Progressbar is not working as smooth as it should be.

The issue i noticed on OSX is that you need to do an app refreshg or redraw, cant remember the proper name now. The issue with that is that is sluggish and slow. Therefor i try to avoind and thus leaving out the progressbar. I did many tests with an CEP panel for photoshop, which ran over 100 or more layers. The difference showing or not showing was sometimes more then a 1 minture. I know a minute is short, but if your waiting its long.

Another issue i see, not sure why. On Windows feels like crap and sluggish. At work i have a 10 year Mac Pro and its faster vs my Omen 15 4800h laptop with newer photoshop. Perhaps its because its AMD chip, im not sure. But the app is lagging like crazy. Have updated couple times and never seems to be fixed.

@schroef
Copy link
Author

schroef commented Oct 28, 2021

PS Photoshop still ships with all those default scripts from what is it, early 2000 orso. Still see code in the from late 90very late 90s. They dont update them, the core is still the same. Some of them are broken actually. Like some parts in the "Layercomps to files".

Wish they would expand more of the internal code. Lots things are still unreachable for JSX. Hope they do keep it with that new UXP method for panel they are using now.

@antipalindrome
Copy link
Owner

@schroef I just released a new version of the script which adds a checkbox "Run Silently" that doesn't render the progress bar on export or give the final success confirmation. Hoping that helps?

@schroef
Copy link
Author

schroef commented Oct 31, 2021

@schroef I just released a new version of the script which adds a checkbox "Run Silently" that doesn't render the progress bar on export or give the final success confirmation. Hoping that helps?

Did you do speed tests with it? Im curious how the progressbar runs on other systems. Currently my Photoshop 2021 on WIndows has been lagging like crazy! The application hangs for seconds at a time randomly, nothing works. Its been like this for a couple of updates.

@antipalindrome
Copy link
Owner

antipalindrome commented Oct 31, 2021

@schroef I ran the script on a 300 layer, 2550x3300px 300 ppi file. I only changed whether I ran silently or not.
I didn't notice any real perceivable difference -- but I also don't experience the issues you do with it, unfortunately.

I'm running (and developing) on macOS Catalina v10.15.7 and Photoshop CC 2021 v22.5.1 with a 2.4Ghz 8-core Intel i9 and 32GB of memory.

@schroef
Copy link
Author

schroef commented Nov 2, 2021

PS i also discovered a trick or tip, when you enter fullscreen mode, it is faster. Thats because it doesnt need to redraw the app in the background. I did tests for that and had a 10-30 seconds gain when doing lots of layers.

If you like and or are interested you can use this command to enter fullscreen when the code starts running after the dialog

// To fullscreen to speeds > ui doesnt need to be updated
            app.runMenuItem(stringIDToTypeID('screenModeFullScreen'));

Then at the end i exit fullscreen with this code

app.runMenuItem(stringIDToTypeID('screenModeStandard'));

Yeah perhaps its just windows, not sure whats going on. I find it strange that my Mac Pro a 2009 machine is like 3x faster vs my Windows Omen 15 4800h. Photoshop is so dang sluggish and lagging there, the UI is constantly hanging.

Ill try your revised version, see what my system run with it. Ill try to make a simple doc using same doc size and 300 layers

@schroef
Copy link
Author

schroef commented Nov 2, 2021

I already noticed one thing. For me on OSX 10.11.6 (yeah its old) and using PS 2018cc, the progressbar does not update. I only see that small window, no progressbar. Thats one thing why i dont like to use. It doesnt work properly across different systems
Screen Shot 2021-11-02 at 12 00 17

@schroef
Copy link
Author

schroef commented Nov 2, 2021

The only fix me is using this trick;

win.hide(); 
win.show(); 

Only then do i see the bar do its work, but the UI looks weird and flickers
I stay away from app.refresh() this tends to slow down the UI as its forces a complete redraw of the UI.

Screen Shot 2021-11-02 at 12 04 59

layers-tofiles-70xS

@schroef
Copy link
Author

schroef commented Nov 2, 2021

PS there is another thing i just noticed. When you export and you use "Visible Only", the counting is off. It exports only 50 yet when its exporting it states 72 and when done also states 72 done. Seems like a miscount. The document actually has 78 layers, but couple are missing and lots of those are in hidden folders.
Screen Shot 2021-11-02 at 12 22 49
Screen Shot 2021-11-02 at 12 17 13
Screen Shot 2021-11-02 at 12 16 47
. I got 50 files in the folder.

@schroef
Copy link
Author

schroef commented Nov 2, 2021

My guess, its sees these layers inside this group as not hidden.
Screen Shot 2021-11-02 at 12 24 34

If manually check this, it confirms my suspicion. i Guess when you are running over the layers and check there layer data, it should actually skip when a layer folder is hidden. You using a recursive function i guess for this.

There is an error in either you layercount code or photoshop layercount function. In Photoshop it tells me my document has 78 layers and 15 groups. When i run a alert command after the script counts layers, it returns 107?! Kinda weird right?
Screen Shot 2021-11-02 at 12 31 11
Screen Shot 2021-11-02 at 12 31 05

I have this count script, it returns the same as Photoshop. Now i wonder why that command layerCount = desc.getInteger(app.charIDToTypeID("NmbL")); return a "wrong" number

@schroef
Copy link
Author

schroef commented Nov 2, 2021

I tried a different script, which also uses the same command as this fast layer exporter, that also returns 107. Thats quite weird now, seem like the command in my photoshop version has an error.

I tried this simple function and this also returned 107

function getNumberOfLayer() {
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var desc = executeActionGet(ref);
    var numberOfLayer = desc.getInteger(charIDToTypeID("NmbL"));
    return numberOfLayer;
};

alert(getNumberOfLayer())

I now even went so far by doing manual layer count, that script command is definitely wrong. I also count 78 as like Photoshop show me.

AFter ungrouping all groups and sub-groups, i do that function again. I guess this commands counts groups as groups, but also as layers and therefor is double counting orso?!? I would need to make simple test doc for this. I was just curious why that weird number returned
Screen Shot 2021-11-02 at 12 59 06

EDIT
Okay i can confirm it now, when i add 1 group now in this document, the count goes from 78 to 80. So that means a group is counted twice?!?! Thats weird!

@antipalindrome
Copy link
Owner

antipalindrome commented Nov 8, 2021

My guess, its sees these layers inside this group as not hidden.

I found this behavior too, and made a ticket here #174. Not sure if this covers your use-case too, but that how I was able to reproduce it.

There is an error in either you layercount code or photoshop layercount function. In Photoshop it tells me my document has 78 layers and 15 groups. When i run a alert command after the script counts layers, it returns 107?! Kinda weird right? Screen Shot 2021-11-02 at 12 31 11 Screen Shot 2021-11-02 at 12 31 05

I have this count script, it returns the same as Photoshop. Now i wonder why that command layerCount = desc.getInteger(app.charIDToTypeID("NmbL")); return a "wrong" number

This is interesting. I'd have to maybe play around with it more, but I'm getting accurate counts on my PSDs.

Screen Shot 2021-11-08 at 09 02 54

When I export it the count and alert are accurate too, except when it's off by one like in #175

@schroef
Copy link
Author

schroef commented Nov 8, 2021

Well the count in the bottom left corner and the amount of layers in the layer palette is correct indeed. What I meant is running that command count layers. I've noticed, it counts groups twice. You can simply test this, using 1 layer inside one group. The command count will return 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants