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

Reduce file dimension size by specified amount

New Here ,
Aug 07, 2008 Aug 07, 2008

Copy link to clipboard

Copied

we are trying to create an action or script to reduce images by .0625" from all 4 sides of artwork we receive from our customers. Anyone have any ideas?
TOPICS
Actions and scripting

Views

748

Translate

Translate

Report

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
Valorous Hero ,
Aug 07, 2008 Aug 07, 2008

Copy link to clipboard

Copied

This should be close....



#target photoshop

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var res = activeDocument.resolution;

var cropFactor = res/8;

var Width = activeDocument.width.value - cropFactor;

var Height = activeDocument.height.value - cropFactor;

app.activeDocument.resizeCanvas(Width, Height, AnchorPosition.MIDDLECENTER);

app.preferences.rulerUnits = startRulerUnits;

Votes

Translate

Translate

Report

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
Advocate ,
Aug 07, 2008 Aug 07, 2008

Copy link to clipboard

Copied

A simple action would work as well.

Just create a new action, choose 'canvas size', and make sure that 'Relative' is checked, and enter -.125 inches into both boxes.

Votes

Translate

Translate

Report

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 ,
Aug 09, 2008 Aug 09, 2008

Copy link to clipboard

Copied

thanks guys, but that doesnt actually solve the problem. We do not want to crop the image...we need to RESIZE it. We have to keep the image intact, but just resize it down .0625 on all 4 sides.

Votes

Translate

Translate

Report

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
Valorous Hero ,
Aug 10, 2008 Aug 10, 2008

Copy link to clipboard

Copied

Sorry about that, this should do it now.
NB: Resizing will not constrain proportions unless the artwork is SQUARE.



#target photoshop

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var res = activeDocument.resolution;

var cropFactor = res/8;

var Width = activeDocument.width.value - cropFactor;

var Height = activeDocument.height.value - cropFactor;

resize(Width,Height);

app.preferences.rulerUnits = startRulerUnits;



function resize(Width,Height) {

var ad = new ActionDescriptor();

ad.putUnitDouble( app.charIDToTypeID('Wdth'), app.charIDToTypeID('#Pxl'), Width );

ad.putUnitDouble( app.charIDToTypeID('Hght'), app.charIDToTypeID('#Pxl'), Height );

ad.putEnumerated( app.charIDToTypeID('Intr'), app.charIDToTypeID('Intp'), app.stringIDToTypeID('bicubicSharper') );

executeAction( app.charIDToTypeID('ImgS'), ad, DialogModes.NO );

};

Votes

Translate

Translate

Report

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 ,
Aug 10, 2008 Aug 10, 2008

Copy link to clipboard

Copied

Thanks Paul! Ok two quick questions:

#1 why when we run the script it doesnt take off a total of .0625? The length of an image that I resized was 4.25, but after I ran the script it brought the size down to 4.127.

#2 Where in the script does it define the amount that the image needs to be resized?

Votes

Translate

Translate

Report

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
Valorous Hero ,
Aug 10, 2008 Aug 10, 2008

Copy link to clipboard

Copied

What it does is, change the document to pixels
app.preferences.rulerUnits = Units.PIXELS;
Therefore 1 inch is equal to the resolution of the document.
var res = activeDocument.resolution;
here res is now 1 inch
Maths is now done res/8 = ( 1" / 8 ) = cropFactor
This is then deducted from the original width
var Width = activeDocument.width.value - cropFactor;
and the original height.
var Height = activeDocument.height.value - cropFactor;
These values are sent to the resize function.

Votes

Translate

Translate

Report

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 ,
Aug 15, 2008 Aug 15, 2008

Copy link to clipboard

Copied

LATEST
Paul, would you mind emailing me directly? barry @ m3printing.com

Votes

Translate

Translate

Report

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