PHOTOSHOP - Fit image.jsx with effects style scaling

  • 1
  • Question
  • Updated 2 years ago
  • (Edited)
First timer here so hopefully can get some advice. Is there a way to include effect styles scaling in the fit image.jsx script? My current problem is when the script runs it doesn't scale layer styles like an "image resize" would do and the effects goes whack at different dimensions. Is there another way of using image resize in my action to fit both landscape or portrait images into a fix square at different dimensions?

My current actions are
Trim
Fit Image W3800 x H3800
Canvas Size W4000x H4000
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
You can add the flag to scale layer styles to the script.
But layer style scaling has it's limits (because of the limits of styles) and won't always scale as expected.
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes
hmm I cant see the parameter for this option: http://sklad.bereza.cz/00-jarda/00_sc... and dialog has this option: http://www.tech-recipes.com/wp-conten...
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes
I got code with flag using script listner
var idImgS = charIDToTypeID( "ImgS" );
    var desc1250 = new ActionDescriptor();
    var idWdth = charIDToTypeID( "Wdth" );
    var idPrc = charIDToTypeID( "#Prc" );
    desc1250.putUnitDouble( idWdth, idPrc, 10.000000 ); // <-- 10 % of original image
    var idscaleStyles = stringIDToTypeID( "scaleStyles" ); // <---flag
    desc1250.putBoolean( idscaleStyles, true );
    var idCnsP = charIDToTypeID( "CnsP" );
    desc1250.putBoolean( idCnsP, true );
    var idIntr = charIDToTypeID( "Intr" );
    var idIntp = charIDToTypeID( "Intp" );
    var idautomaticInterpolation = stringIDToTypeID( "automaticInterpolation" );
    desc1250.putEnumerated( idIntr, idIntp, idautomaticInterpolation );
executeAction( idImgS, desc1250, DialogModes.NO );
 
Photo of Ricky Boyce

Ricky Boyce

  • 1 Post
  • 0 Reply Likes
Thank you, I have scoured the internet for such a script and believe this is the only reference to scale both the image and style. 
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
Thanks for taking the time to respond. I tried to convert all layers to one smart object and using the fit image script, the effects style does maintain its look, but the problem is when i upscale the image the smart object looks like a raster image instead of scaling like a vector smart object would.
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 812 Reply Likes
Well, yes, of course -- you are scaling a raster image, not a vector.
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
Yes i do understand that but is it possible to keep the scalability of a vector smart objects with effects style while using fit image action?
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 812 Reply Likes
No, because you are scaling a raster image.
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
If thats the case what would you suggest if i wish to achieve upscaling a vector smart object (pdf) to a fixed square dimension in an action without losing quality?
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes
Add this to your script: http://www.creativetechs.com/tipsblog... Only this way will work.

But it has limits e.g. drop shadow can be max 250px
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
Would the command be able to apply to both up and down scaling? If so where do I put them in the fit image.jsx script? Thanks
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
Just another note I have zero experience with scripting so would be great if you can point me a guide I can follow.
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes
This script can do it. http://blog.kam88.com/en/transform-ea... But seems to be compiled. I don't know how to write this in code... maybe you can find it somewhere here: http://www.adobe.com/devnet/photoshop...
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
Thanks JB, this almost does it, but somehow it's not working that well on some of my files as some layers didn't scale together.
Photo of KL Tan

KL Tan

  • 13 Posts
  • 0 Reply Likes
I think if we can get the Scale Styles check box into the fit image.jsx than my question would be answered