Conditional resampling

SF
Posted By
Scott_Falkner
Jan 9, 2007
Views
602
Replies
21
Status
Closed
I’d like to add a step to an action that resamples images above 1800 px wide to 1800 px wide. If the image is less than that, I don’t want it upsampled (obviously). Is there way to affect only the appropriate images with this action and run it as a batch?

Crossposted.

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

MV
Mathias_Vejerslev
Jan 9, 2007
Yes.

Sort the folder of your images first, weeding out the ones that are less than 1800px tall/wide.
SF
Scott_Falkner
Jan 9, 2007
Not a solution. I’m looking for a condition step in an action, or perhaps a way to combine a script and an action. I already know I can filter the images. I want PS to do it.
DM
dave_milbut
Jan 9, 2007
something like…

if (document.width > 1800)
resizeTo1800(); //your resize function…
SF
Scott_Falkner
Jan 9, 2007
Um, yeah. Is that a script, part of a script, or just a programming-languagey way of stating the issue?
DM
dave_milbut
Jan 9, 2007
hi scott, it’s part of a javascript script. i checked the javascript cs2 sdk and "document.width" is the value you want to check. you need to write the function "resizeTo1800()". or you can find a resize script and modify it.
SF
Scott_Falkner
Jan 9, 2007
Aw crap. I was hoping to avoid scripting. Thanks for the tip.
DM
dave_milbut
Jan 9, 2007
i’m not sure if they ever including conditionals for actions. (maybe it was imageready?). there was some talk about it i think back between 7 and cs, but i don’t follow it (ps scripting) that closely to recall for sure if it was ever implimented or how rubust it is…
DM
dave_milbut
Jan 9, 2007
hmm yea, it was image ready. you might be able to do it in there.

google: "photoshop conditional actions" without the quotes…

hth, dave
SF
Scott_Falkner
Jan 9, 2007
That might do it. Too bad IR can’t read CMYK files. Too bad Photoshop doesn’t have ImageReady’s condition action or even Action options in the Image Size dialogue.

Things are really messed up at Adobe, lately. I get the impression that the team responsible for each program never even heard of others.

Oh great. ImageReady can’t save as TIF! And the Save As destination is not the same as the original file’s location. Seriously, WTF? Adobe really needs as Ass-kicking Dept. with a large boot budget.
C
chrisjbirchall
Jan 9, 2007
None of this will be a problem in the next version of ImageReady! 🙁
SF
Scott_Falkner
Jan 9, 2007
That’s too bad. I was hoping ImageReady would go the way of intelligent political debate.
C
chrisjbirchall
Jan 9, 2007
intelligent political debate

like… erm… non existant, you mean! 😉
SF
Scott_Falkner
Jan 10, 2007
If the star of Taxi crashed, would he get a J Hirsch car bill?
MV
Mathias_Vejerslev
Jan 10, 2007
Scott,

Have you tried File>Automate>Fit Image?
DM
dave_milbut
Jan 10, 2007
I thought that too mat, but that would also resample smaller sizes up, which he doesn’t want to do…
D
deebs
Jan 10, 2007
Shock! Horror! ImageReady to go into non-existence?

Uh-huh – it is far too good (even if it may be underrated) and needs a good dash and sparkle of new stuff.

However, a skillful user can obtain a great deal from IR even in its present state. (Looks like i better archive my IR installibles?)
GD
george_dingwall
Jan 10, 2007
Hi Scott,

I use scripts to resize my images, but at the momment they resize all of the images in a folder. It should be relatively easy to modify one of these scripts to not resize any image smaller than 1800 pixels.

A couple of questions before I give it a try.

1. Do you always want the image width to be 1800 pixels, or do you really mean that you want the long side of the image to be 1800 pixels?

2. If the image is less than 1800 pixels, do you want to do anything to it at all or do you just want to ignore it?

Bye for now
SF
Scott_Falkner
Jan 10, 2007
I get images from several sources, some digital and some as C-prints. The prints I scan to the size I want. The digitals I have little control over.

All images end up placed in a catalogue, and none are wider that 6 inches, so 1800 pixels is the maximum size I’ll need. I have to make several of these catalogues, up to maybe five or six a week. That’s a lot of photos taking up a lot of space and slowing down a lot of InDesign files.

I’d save time and server space by squashing some of these photos. I don’t want to have to spend a lot of time doing it, so an action or a droplet would be ideal.
GD
george_dingwall
Jan 11, 2007
Hi Scott,

If I’m to help you I need to know how you want an image to be resized.

Do you always want the width to be 1800 pixels regardless of the height of the image, or do you want the longest side of the image to be 1800 pixels?

If you have an image that is taller than it is wide, do you still want the width to be 1800 pixels?

Bye for now.
SF
Scott_Falkner
Jan 11, 2007
Begin
IF width > 1800
resample so that the width is 1800
ENDIF

In the ned, no matter the aspect ratio, orientation, or resolution of the original files, I want no image’s width to be more than 1800 pixels without upsampling anything.

Imageready has a command for this. In the Image Size dialogue you can set Action options to do exactly what I want. Unfortunately you cannot use CMYK images and you cannot record save actions. So I can only export to PNG (because I want lossless files) , which will remove the ppi setting in the image.
GD
george_dingwall
Jan 11, 2007
Hi Scott,

Here’s a simple script that will resize any image to 1800 pixels wide regardless of the orientation of the original image. It will not upsample any images whose width is 1800 pixels or less.

I’ve made the 1800 pixel value a variable named "target". This means that you can easily modify the variable if you ever need to use a different size, without having to delve further into the script to find the exact location of the width value.

– – – – – script starts here – – – – –

var orig_ruler_units = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var target = 1800;
var doc = app.activeDocument;
if (doc.width.value > 1800)
{
resize(target)
}
function resize()
{
var id52 = charIDToTypeID( "ImgS" );
var desc4 = new ActionDescriptor();
var id53 = charIDToTypeID( "Wdth" );
var id54 = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( id53, id54, target );
var id55 = stringIDToTypeID( "scaleStyles" );
desc4.putBoolean( id55, true );
var id56 = charIDToTypeID( "CnsP" );
desc4.putBoolean( id56, true );
var id57 = charIDToTypeID( "Intr" );
var id58 = charIDToTypeID( "Intp" );
var id59 = stringIDToTypeID( "bicubicSharper" ); desc4.putEnumerated( id57, id58, id59 );
executeAction( id52, desc4, DialogModes.NO );
}
app.preferences.rulerUnits = orig_ruler_units;

– – – – – Script ends here – – – – –

If you run this script from an action, you can apply the changes to a folder of images using the Automate/Batch option in the file menu.

Hope this helps.

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Related Discussion Topics

Nice and short text about related topics in discussion sections