Copy link to clipboard
Copied
I am pretty new to Photoshop and Photoshop scripting and I had to work for a few weeks on a Photoshop JS script that reads a configuration file and overlays colors, replaces images, replaces texts according to the conf file and exports layers to PNG files.
Everything works fine on my mac but I have several problems trying to execute it on another mac. While all my images are perfectly placed when I execute my script on my mac, on the mac of my coworker (which is the mac where this script is supposed to be used) the images are place below the right place.
What did I miss? Is there some configuration or preferences I have to set for Photoshop to count properly the coordinates?
So you can have some hints I have below the functions I use to replace and move my images (found on the web).
Copy link to clipboard
Copied
Are you testing with the same documents files on both machine. Smart Object Replace content has some dependencies. Replacement object need to be exactly the same Aspect Ratio, Size and Resolution as the object in the the template PSD smart object layer. For the Smart Object Lasyer's associated Object Transform is not replace or altered when you use replace content. If the replacement Object is different the transform will not work correctly and moving the transformed object will not correct the problem.
Copy link to clipboard
Copied
I used the same template, same configuration file and same images to replace for both of the machines. Also my Photoshop script is launched by an Applescript that makes a copy of my template, runs my Photoshop script on this copy and then uses the generated images with other softwares. So every time the Photoshop script is launched the PSD file is always a copy of the same template file. I tried launching my script manually on Photoshop if it could explain the different behaviours but Applescript does everything correctly.
Copy link to clipboard
Copied
What are the Ruler Units?
Copy link to clipboard
Copied
Are the machine running the same Mac OS and same PS version ? Same Add-ons. What is different? Preferences hardware etc. There should be something that is different if results differ.
Copy link to clipboard
Copied
We both have PS 2020, I have Mac OS 10.14.6 while his mac works on 10.15.2
There's no add-on his instance of PS and I have Script Event Listener, needed it to make some Action Scripts.
Our preferences are similar, the differences are:
-the RAM used by photohop (9905 MB in my mac, 4169 MB in his mac)
-the Cache Tile Size (1024K in my mac, 128K in his mac)
Do you think these differences can change anything? And if you think so what could I do so my script works the same way on any mac?
Copy link to clipboard
Copied
Does the Script set the Ruler Units?
Copy link to clipboard
Copied
In fact you were right I didn't set the Ruler Units in the script, but I thought it wouldn't change anything because we have the same preferences in the Ruler and Units menu.
I can't try it today because I'm not next to the mac where my script should be used, I will try tomorrow and will tell if it worked or not.
So for my test of tomorrow I have these units:
Copy link to clipboard
Copied
I just went back from testing and even after I set the ruler units to what I wrote you in previous message the images are still placed below where it is supposed to be...
Is there any preferences configuration or anything I could have missed?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Just tried to change to Units.POINTS, but it didn't change anything...
Copy link to clipboard
Copied
Are you sure you are replacing the object with object the same aspect ratio size and resolution. If the smart replacement is not the correct size The smart object layer's Object Transform will not transform the object like the original object was transformd. The translate move of the layer will be different then with the original layer for the layer's bounds which the move is base off of will be different then the original smart objects layer's pixels bounds. It not an absolute x y postion move its a calulated x y position relative to the smart object layers bounds position.
fY and fY are values passed, Position[0] and Position[1] retrieved from Photoshop the smart object layer pixels content upper and lef bounds which are changes using fX and fY. If ruler units are set to Pixels photoshop should return pixel off set relative to the document upper left corner position x=0, y=0 for the Layers pixels bounds before factoring in fX and fY. How fX and fY are set was not shown.
The move is in the negive direction of value position[0] and Position[1]
fLayer.translate(-Position[0],-Position[1]);
Some kind of relative move
Copy link to clipboard
Copied
You may have a point... Some images are more "misplaced" than other and now that you say it the images that are the most reduced are the most misplaced in the final PS file.
I used the Window > Info menu to get info on an image but I don't know if the given dimensions are the dimensions of the image file or the dimensions of the image in the PS file.
I have put my images in masks and my script has an algorythm to resize the images properly so I didn't think about that because my images was always at the right size but you may be right.
I have two questions with what you said in mind:
-Why my script places my images properly on my mac no matter the original size of the image but not on another PS instance?
-Is there a way to place the image, using top left corner of the image as coordinates so that the size does not matter?