What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Scripting Photoshop Script for Measuring


Virgomark

New Member
Messages
2
Likes
0
Hi All,

Ive been trying to figure out how to make a script that makes a rectangle read at 250px long. Ive been just dividing the default px height by 250px to find the percentage difference and size down with that percentage.

I'm trying to figure out if there is a way for photoshop to script that can automatically do that math?

so far i got
Step 1 : Select path
Step 2: x divided by 250px = "Percentage"
Step 3: Image size down to "Percentage"

But im not sure how to do step 2 in a script.
 
Hi @Virgomark
I am not a scripting expert yet there are forum members that are so they may jump in.

If I understand your project correctly, you want to take the arbitrary dimension of an object in your image and scale the image so that old dimension becomes an exact new dimension with everything else in the image scaling proportionately.

Its not clear if you are scaling vector objects or rasterized objects in your question.

Here is an alternate set up steps that may work for you or at least open up some ideas on possibilities.

1) Select with the crop tool the object exactly at the desired boundaries you want to scale. Choose in the tool option bars to not delete pixels when you crop. This will make the new visible image the exact present dimension of X and also that will be 100% of the image window.

2) Use Image > Image Size, set to resample, and set the full image pixel width or height of you critical dimension to the new desired pixel dimension. If you need sharp edges when you are done you should choose the rendering option as nearest neighbor yet you can choose the rendering algorithm that meets you needs best. When accepting the resize the full image is of you critical dimension resize to the desired dimension (e.g. 250px if you set the height or width to 250px)

3) Now to recover the full image back all you need to do is use the command Image > Reveal All and the original image scaled the same way as your desired object (rectangle).

Just another way to go after this problem and hope that provides a possible path to consider in solving your project.

John Wheeler
 
Hi @Virgomark
I am not a scripting expert yet there are forum members that are so they may jump in.

If I understand your project correctly, you want to take the arbitrary dimension of an object in your image and scale the image so that old dimension becomes an exact new dimension with everything else in the image scaling proportionately.

Its not clear if you are scaling vector objects or rasterized objects in your question.

Here is an alternate set up steps that may work for you or at least open up some ideas on possibilities.

1) Select with the crop tool the object exactly at the desired boundaries you want to scale. Choose in the tool option bars to not delete pixels when you crop. This will make the new visible image the exact present dimension of X and also that will be 100% of the image window.

2) Use Image > Image Size, set to resample, and set the full image pixel width or height of you critical dimension to the new desired pixel dimension. If you need sharp edges when you are done you should choose the rendering option as nearest neighbor yet you can choose the rendering algorithm that meets you needs best. When accepting the resize the full image is of you critical dimension resize to the desired dimension (e.g. 250px if you set the height or width to 250px)

3) Now to recover the full image back all you need to do is use the command Image > Reveal All and the original image scaled the same way as your desired object (rectangle).

Just another way to go after this problem and hope that provides a possible path to consider in solving your project.

John Wheeler
Thank you! this works perfectly !
 

Back
Top