Trying to record w and h in info panel to create auto straighten object script in photoshop.
- September 22, 2022
- 2 replies
- 724 views
I am trying to create a script to auto straighten items in ps cc. (note "crop & straighten" automation works well but not 100%; also note I can achieve this in lightroom but want to keep the process in cc).
The basic question I am asking is how to I record w and h values of selected items in the F8 info panel. I want to compare two h values and then return a command to photoshop to rotate an item based on the result. Is this done with javascript? VB? Where is a good resource to learn how to do this? I know my way around cc but know little about coding andmy coder is not familiar with cc. The explanation for why I am doing this is below...
Items I want to auto straighten are individual artworks on greenscreen background. After removing background I am left with an item which will be usually slightly skewed. To auto straighten the item I need to know the top left and top right information for the item so I can calculate the degree of rotation needed to auto straighten. CC doesnt seem to have an option to give this info. Cntl T doesnt reveal the lower of the two points.
But I have a work around. I use "Image>Canvas size" and remove 95 percent of the left hand side of the image. Then "Image>Trim" to remove any blank space above.
I then undo the canvas size and repeat that process after remopving 95% of the right hand side of the image.
I can then compare the height of the trimmed ( Image>Trim) left and right sides. If left is 30 pixels shorter than the right then I know I have to rotate the left 15 pixels up to straighten the image.
Thanks