Anyone worked out how to do this?

F
Posted By
Figo
Dec 4, 2003
Views
393
Replies
5
Status
Closed
Hello again

Here’s today’s conundrum. I’m trying to run a script that will resample an image size depending on whether the length or the width is greater.

So for example, i have several images that are roughly 50 (wide) x 30 ( high). I want the script to make them all 50 x 30, without distorting and without randomly clipping data from all around. The original sizes aren’t all in that exact 5:3 ratio. One image may be 52 x 29, while another is 49 x 32.

So the ideal script would say something like,
? if the width divided by height is greater than 5/3, then resize the image (constrain proportions) and make the height = 30, then crop the width down to 50.
? if the width divided by height is less than 5/3, then resize the image ( constrain proportions) and make the width = 50, then crop the height down to 30.

ie each time it’s only cropping one side, and there is no distortion. Does that make sense? Has anyone had any success with something like that? Or is there a plug-in that anyone knows about?

TIA

Figo

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

PJ
Peter Jones
Dec 5, 2003
On 5 Dec 2003 05:58:57 +0800, Figo wrote:

Hello again

Here’s today’s conundrum. I’m trying to run a script that will resample an image size depending on whether the length or the width is greater.
So for example, i have several images that are roughly 50 (wide) x 30 ( high). I want the script to make them all 50 x 30, without distorting and without randomly clipping data from all around. The original sizes aren’t all in that exact 5:3 ratio. One image may be 52 x 29, while another is 49 x 32.

So the ideal script would say something like,
? if the width divided by height is greater than 5/3, then resize the image (constrain proportions) and make the height = 30, then crop the width down to 50.
? if the width divided by height is less than 5/3, then resize the image ( constrain proportions) and make the width = 50, then crop the height down to 30.

ie each time it’s only cropping one side, and there is no distortion. Does that make sense? Has anyone had any success with something like that? Or is there a plug-in that anyone knows about?

TIA

Figo

As far as I’m aware, Actions cannot contain ‘logic’ – ie: if the width is greater than the height… You can write scripts for PhotoShop using JavaScript, but it’s quite involved.

For easier scripting, you’re better off looking at a different product for this solution. For example, if you can get your hands on Corel PhotoPaint vers 9 or earlier ($20-$45, newer versions don’t have CorelScript so tightly integrated), CorelScript for this is relatively trivial…

WITHOBJECT "CorelPhotoPaint.Automation.8" ‘ or version 9… width = .GetDocumentWidth()
height = .GetDocumentHeight()
dpi = 100
IF width / height > 5 / 3 THEN
.ImageResample width * 30 / height, 30, dpi, dpi, TRUE
.ImageCrop 0, 0, 30, 50
ELSE
.ImageResample 50, 30 * 50 / height, dpi, dpi , TRUE
.ImageCrop 0, 0, 50, 30
ENDIF
END WITHOBJECT

Peter
Digital Photography Reference
http://members.shaw.ca/jonespm2/PJDigPhot.htm
Touchup, an image viewing applet (also shows EXIF)
http://members.shaw.ca/jonespm2/software.htm
Health, happiness and healing
http://www.SuperNaturalWoman.com
N
nospam
Dec 5, 2003
In article , Peter Jones
wrote:

On 5 Dec 2003 05:58:57 +0800, Figo wrote:
So the ideal script would say something like,
? if the width divided by height is greater than 5/3, then resize the image (constrain proportions) and make the height = 30, then crop the width down to 50.
?
WS
Warren Sarle
Dec 6, 2003
"Peter Jones" wrote in message
On 5 Dec 2003 05:58:57 +0800, Figo wrote:

As far as I’m aware, Actions cannot contain ‘logic’ – ie: if the width is greater than the height… You can write scripts for PhotoShop using JavaScript, but it’s quite involved.

For easier scripting, you’re better off looking at a different product for this solution. For example, if you can get your hands on Corel PhotoPaint vers 9 or earlier ($20-$45, newer versions don’t have CorelScript so tightly integrated), CorelScript for this is relatively trivial…

WITHOBJECT "CorelPhotoPaint.Automation.8" ‘ or version 9… width = .GetDocumentWidth()
height = .GetDocumentHeight()
dpi = 100
IF width / height > 5 / 3 THEN
.ImageResample width * 30 / height, 30, dpi, dpi, TRUE
.ImageCrop 0, 0, 30, 50
ELSE
.ImageResample 50, 30 * 50 / height, dpi, dpi , TRUE
.ImageCrop 0, 0, 50, 30
ENDIF
END WITHOBJECT

And a Photoshop script using VBScript would look very much the same. A Javascript script would have mainly cosmetic differences. How do you figure the Corel script is any easier?
N
nospam
Dec 6, 2003
In article <FGaAb.78135$>, "Warren
Sarle" wrote:

"Peter Jones" wrote in message
[]
[… blah blah blah ..]

And a Photoshop script using VBScript would look very much the same. A Javascript script would have mainly cosmetic differences. How do you figure the Corel script is any easier?

Or even neccessary.
F
Figo
Dec 6, 2003
Thanks guys. I went with an applescript, which has taken me all farking afternoon to write (have never written an applescript before in my life)

Now I don’t want to sound really stupid, but how do i get the applescript to launch from within photoshop 7? I have the plugin, but when i go to file / automate / scripts, all the applescripts are greyed out. I can only select javascripts!

Any of you guys using PS7 for mac (panther) and got the applescripts to run from *within* photoshop?

Figo

In jjs wrote:
In article <FGaAb.78135$>, "Warren
Sarle" wrote:

"Peter Jones" wrote in message
[]
[… blah blah blah ..]

And a Photoshop script using VBScript would look very much the same. A Javascript script would have mainly cosmetic differences. How do you figure the Corel script is any easier?

Or even neccessary.

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Related Discussion Topics

Nice and short text about related topics in discussion sections