Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Building automation to Resize by fileweight and dimension. I'm so close. Any ideas?

New Here ,
Sep 17, 2013 Sep 17, 2013

Greetings,

I'm pretty new to the JS world but have been using Photoshop for the better part of 2 decades and have ALWAYS wanted something that would let me set filesize/weight limitations. The world appears to have given up before me (which should be a sign to stop?) but I can't give up now; that, and my employer has asked me to figure this out. So here I am asking for your help.

Here's a gist of the code I have. It is "sorta" working but for some reason with larger file sizes it seems to make the file larger, then smaller etc etc. and loops infinitely. I'm thinking somehow it keeps grabbing an older version of the file, and possibly my problem might be in the saving procedure. ANY input would be extermely welcome, including suggestions on how to accomplish things more elegantly etc.

https://gist.github.com/anonymous/95374b5e3db88261ce4c

Basically I need to get the file down below 95k. First by lowering quality (because it is all that is necessary for MOST of the files I am handing in) to a limit of 50% then begin lowering size by 72px until the lower limit of pixel dimension it met.

Ideas?

TOPICS
Actions and scripting
741
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Sep 17, 2013 Sep 17, 2013

It has been a few years but I seem to remember that when I and Xbytor tried to do something like this we determined that either the OS or ExtendScript was chacing the file so the size is sometimes incorrect. I don't remember if we found a way around that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 17, 2013 Sep 17, 2013

Michael, any chance you have some of that code floating around? I'd like to see how you wizards tackled it vs what my mundane self is up to. I wonder if there's a way I can pass the SaveForWeb adjusted files to an automator app or a standard Photoshop action for the resizing bit, since that process is much simpler. Maybe that would help route around that file caching issue; if that is in fact what the problem was. I have noticed no issues with the first While loop handling everything down to 50% quality, but it seems like the passing from one loop to the next is where things get wonky. Ugh I know just enough JS to break things. So frustrating being so close to an answer!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 17, 2013 Sep 17, 2013

No, sorry. I looked in my code library and did a search at ps-scripts.com. I think when we were working on this was longer than a few years. I did find a post at ps-scripts dated 2008 were I told someone of the chacing problem. I will keep searching( the thread I am thinking about may have been on the old Adobe Photoshop scripting forum )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2013 Sep 19, 2013
LATEST

Thanks very much for looking into that for me. I owe you a steak dinner or something. I am still going to make this work somehow; even if I make it two separate scripts that are run by an Automator app. Gotta make these things work in a drag/drop setting and the boss really wants to see this happen. If anyone else has a potential solution, I'm all ears!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines