3

1) By File -> Automate -> Fit Image...,

we can fit images of any size or orientation into a particular frame size. But we cannot specify the resample method, like Bicublic Sharper. In fact we do not know what resample method it uses.

2) By Image -> Image Size...,

we can control the resample methods. But for batch processing, like batch resize photos of different orientation, we cannot specify a "fit-frame" size in this menu.

Is there a way/a script/a menu that we can combine the advantages of the two - Batch Fit Image with Bicublic Sharper?

2 Answers 2

3

You can actually take a look at the source of the Fit Image script. It's in \Presets\Scripts\Fit Image.jsx (at least for CS5).

In my script, the resampling method is on line 135:

app.activeDocument.resizeImage(newWidth, newHeight, resolution, ResampleMethod.BICUBIC);

So there you go, the default method is Bicubic.

According to the reference guide, we can send one of the following:

  • BICUBIC
  • BICUBICSHARPER
  • BICUBICSMOOTHER
  • BILINEAR
  • NEARESTNEIGHBOR
  • NONE

Same as the image size dialog in PS (big surprise!), with an additional NONE.


"Band-aid" Script

I am far from an expert at scripting in Photoshop, but I was able to modify the existing Fit Image script to incorporate a re-sampling method dropdown. This works for me in CS5, I did not test it in any other version of Photoshop.

Old Script:

Old 'n' Busted

New Script:

New Hotness

Get it here

Edit: Okay, so this isn't (yet) compatible with a recorded action, which admittedly makes it kinda worthless. I'll have to figure out how that works. Now with recorded action functionality!

6
  • Thanks. But i am using the CS2 version. There is no Fit Image.jsx in my Scripts folder, Event Scripts Only folder neither. If, as quoted in your code, ResampleMethod.BICUBIC is hard-coded into the Fit Image command, i wonder why after i changed my Preferences, the resample method follows?
    – midnite
    Commented May 29, 2013 at 2:06
  • @midnite Interesting, I'm on CS5. I don't have CS2, so I'm not sure how it's set up there.
    – JohnB
    Commented May 29, 2013 at 2:12
  • @midnite, I've put the script on GitHub. Try it out and see if it works for you on CS2
    – JohnB
    Commented May 29, 2013 at 3:45
  • Thanks for your efforts and information. Hmm... may i ask, (1) if you set Bicubic Sharper in the CS5 Preferences, then do the original Fit Image, will the output be using Bicubic Sharper? (You may test the output files with their file sizes. Same resized images, with same resampling method, should have the same file size.)
    – midnite
    Commented May 29, 2013 at 11:58
  • Cont'd, (2) My CS2 Fit Image is at the File > Automate > Fit Image.... CS2 doesn't have Fit Image in File > Scripts > . Where is the CS5 Fit Image?
    – midnite
    Commented May 29, 2013 at 12:08
2

There are two solution to this.

1. Write a script.

Because of this issue, i have just started reading the manuals. i am the programming guy. But Photoshop does contain many classes, and coding JavaScript in plain text editor is not easy. And, more importantly, i found method 2 is working!

2. Through native Photoshop Preferences.

i may need to write a script for more complex operations. But not today. Simply open Photoshop, go to Edit > Preferences > General > Image Interpolation and choose Bicubic Sharper. i have tested this works well with File > Automate > Fit Image... and File > Scripts > Image Processor..., which means both will use Bicubic Sharper for resampling :)

P.S. i chose to build my own Action with Fit Image because i feel more safe with this. Image Processor is a bunch of codes, which may contain bugs, or may choose resampling methods other than Bicubic Sharper, somehow, in some cases, who knows?

2
  • notepad++ is free open source and has syntax highlighting for javascript. A step up from vanilla notepad.exe
    – horatio
    Commented May 29, 2013 at 14:26
  • Thanks for suggestion @horatio :) i use Notepad++ also. i am just lazy to check out all the new Photoshop APIs :P
    – midnite
    Commented May 29, 2013 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.