Skip to main content
dublove
Legend
April 13, 2024
Question

Before printing, use Photoshop to automatically modify the actual picture size in Indesign?

  • April 13, 2024
  • 4 replies
  • 761 views

When the typesetting is designed, the picture may be used in a large size.
Before printing, we will change the map to the actual size, that is, the size displayed when selecting the tool directly.


Note: Here is a "direct selection tool" (white arrow) instead of "selecting tools" (black arrow).
For example, if the actual width is 132mm, it will be changed to 132+10mm. Of course, the length and width are equal.


Sometimes there are hundreds of pictures, which are troublesome to change. Find a script that can automatically change the size and automatically save.


It turned out that someone had helped write one, but I have not been able to work well, but now I can't open it.

Thank you very much~

 

 

 

//auto changesize and save
Main();  
function Main() {  
    try{var image = app.selection[0].images[0];}catch(e){return}  
    var imagePath = image.itemLink.filePath;  
    var myResolution=350;  
    var hScale=image.horizontalScale*(myResolution/image.actualPpi[0]);  
    var vScale=image.verticalScale*(myResolution/image.actualPpi[1]);  
    CreateBridgeTalkMessage();  
    function CreateBridgeTalkMessage() {  
        var bt = new BridgeTalk();  
        bt.target = "photoshop";  
        bt.body = myResizeImage.toString() + "\rmyResizeImage('" + imagePath + "'," + hScale + "," + vScale +","+myResolution+ ");";   
        bt.send();  
    }  
}  
function myResizeImage(imagePath, hScale, vScale,myResolution) {  
    for(var i=0;i<app.documents.length;i++)  if(app.documents[i].fullName.fsName==imagePath)return;  //if image opend   
    app.bringToFront();  
    app.preferences.rulerUnits = Units.MM;  
    var myFile = new File(imagePath);  
    var myDoc = app.open(myFile);  
    myDoc.resizeImage(undefined,undefined, myResolution,ResampleMethod.NONE);  
    var  w=myDoc.width.value * hScale*0.01;  
    var h=myDoc.height.value * vScale*0.01;  
    var k=w+12.00;  
    var j=h*k/w;  
    myDoc.resizeImage(k,j, myResolution,ResampleMethod.BICUBICSMOOTHER);  
    myDoc.save();  
    myDoc.close();
    }

 

 

 

The following is semi -automatic

 

//Semi -automatic, you need to manually confirm storage
Main();
function Main() {
    try{var image = app.selection[0].images[0];}catch(e){return}
    var imagePath = image.itemLink.filePath;
    var myResolution=350;
    var hScale=image.horizontalScale*(myResolution/image.actualPpi[0]);
    var vScale=image.verticalScale*(myResolution/image.actualPpi[1]);
    CreateBridgeTalkMessage();
    function CreateBridgeTalkMessage() {
        var bt = new BridgeTalk();
        bt.target = "photoshop";
        bt.body = myResizeImage.toString() + "\rmyResizeImage('" + imagePath + "'," + hScale + "," + vScale +","+myResolution+ ");"; 
        bt.send();
    }
}
function myResizeImage(imagePath, hScale, vScale,myResolution) {
    for(var i=0;i<app.documents.length;i++)  if(app.documents.fullName.fsName==imagePath)return;  //if image opend 
    app.bringToFront();
    app.preferences.rulerUnits = Units.MM;
    var myFile = new File(imagePath);
    var myDoc = app.open(myFile);
    myDoc.resizeImage(undefined,undefined, myResolution,ResampleMethod.NONE);
    var  w=myDoc.width.value * hScale*0.01;
    var h=myDoc.height.value * vScale*0.01;
    var k=w+12.00;
    var j=h*k/w;
    myDoc.resizeImage(k,j, myResolution,ResampleMethod.BICUBICSMOOTHER);
}

 

 

This topic has been closed for replies.

4 replies

leo.r
Community Expert
Community Expert
April 13, 2024

If I understand your goals correctly, then I second @rob day's advice to just export to PDF with the desired settings.

 

If you still do have specific needs to edit/scale your images and replace them in InDesign, then you may want to consider commercial tool LinkOptimizer (once again, if I understand correctly what you need, and plus disclosure: I'm the developer):

https://zevrix.com/linkoptimizer

rob day
Community Expert
Community Expert
April 13, 2024

Hi @dublove , Why not Export to a Print PDF and let the Compression tab handle the downsample? Photoshop’s bicubic resample is not going to be an improvement over the Export Compression tab’s Bicubic Downsampling. This would produce the same result as the script:

 

dublove
dubloveAuthor
Legend
April 13, 2024

We generally deposit in TIF formats, change the size to reduce the disk occupation space, and then modify the color in the Lieutenant Colonel of Photoshop, replace the picture in Indesign again, and finally guide the PDF out of the CTP

Robert at ID-Tasker
Legend
April 13, 2024
quote

We generally deposit in TIF formats, change the size to reduce the disk occupation space, and then modify the color in the Lieutenant Colonel of Photoshop, replace the picture in Indesign again, and finally guide the PDF out of the CTP


By @dublove

 

But this doesn't explain why do you need to "For example, if the actual width is 132mm, it will be changed to 132+10mm"?

 

Robert at ID-Tasker
Legend
April 13, 2024

@dublove 

 

I'm not sure I understand what you are trying to achieve.

 

If you want to enlarge the frame - you don't need to resample image in Photoshop - you can just change the size of the "container" - Rectangle the image is in.

 

brian_p_dts
Community Expert
Community Expert
April 13, 2024

You have two options: 

1) Post the existing script here to see if someone can easily debug it for you. 

2) Commission someone to fix it for you.

 

Other than those two options, we are shooting in the dark.