Please help me with the script

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

romancoder
Posts: 3
Joined: Fri Dec 13, 2024 1:18 pm

Please help me with the script

Post by romancoder »

Hello everyone.
Please help me write a script for Photoshop.
It has a built-in script for straightening and cropping, but it crops the object tightly and opens it in a new file.

Help me write a script that makes from picture 1 to picture 2. The background is always black. There should be fields around the picture from the background in the size of 8px. So that I can run the script and it will do it with the current picture and save everything.

Pic1
Image

Pic2
Image

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

dpaintArexx
Posts: 8
Joined: Tue Nov 14, 2023 12:11 pm

Re: Please help me with the script

Post by dpaintArexx »

The result below comes from the provided script using your example jpg as the source.

The result may vary depending on your setup (it was tested on an older version of PS) and any actual content on the white papers.

There where some white parts in the upper left corner edge of the image that had to be compensated for. The script should ignore smaller white areas, but try to keep the entire background mostly black for consistency.

scriptTest copy.jpg
scriptTest copy.jpg (24.96 KiB) Viewed 1229 times
cropBlack8px.zip
(1.53 KiB) Downloaded 47 times
romancoder
Posts: 3
Joined: Fri Dec 13, 2024 1:18 pm

Re: Please help me with the script

Post by romancoder »

dpaintArexx wrote: Tue Dec 17, 2024 10:25 pm The result below comes from the provided script using your example jpg as the source.

The result may vary depending on your setup (it was tested on an older version of PS) and any actual content on the white papers.

There where some white parts in the upper left corner edge of the image that had to be compensated for. The script should ignore smaller white areas, but try to keep the entire background mostly black for consistency.


scriptTest copy.jpg

cropBlack8px.zip
Hello. Thank you very much. Please tell me on which version of PS this script works? I couldn't run it on 2022 and 2019.
dpaintArexx
Posts: 8
Joined: Tue Nov 14, 2023 12:11 pm

Re: Please help me with the script

Post by dpaintArexx »

Hi,

I tried in a more recent version Photoshop 2024 on macOs. And it ran as expected.

What is your process for running the script?

You will need to have an active image open, then:
File -> Scripts -> Browse... <Select the script file>
romancoder
Posts: 3
Joined: Fri Dec 13, 2024 1:18 pm

Re: Please help me with the script

Post by romancoder »

dpaintArexx wrote: Mon Dec 30, 2024 2:10 pm Hi,

I tried in a more recent version Photoshop 2024 on macOs. And it ran as expected.

What is your process for running the script?

You will need to have an active image open, then:
File -> Scripts -> Browse... <Select the script file>
I apologize. I tried it on English PS and everything works. But sometimes it doesn't make an 8px indent on the right.
dpaintArexx
Posts: 8
Joined: Tue Nov 14, 2023 12:11 pm

Re: Please help me with the script

Post by dpaintArexx »

Interesting that it only worked in English version. That is good to know.

Anyway, when the script fails.. What do the source images look like?