Photoshop script: resize and save file
For my own personal project, I have been working quite a lot with photoshop. To keep the repetitive tasks to a minimum, I tried to script most of them. One of these is resizing and then saving/overwriting the image as a png to some location. Here is one way to do that:
Before manipulating the image in any way, make sure to store the current history state of the image (1)
. This way, you can always go back in history to that point. Then, resize the image to 2000 pixels in width (2)
. Using this method, the aspect ratio will be used for calculating height. After that, the image will be saved to C:/image.png
(3)
. This line will call the savePNG function above, saving it as a png with the compression and interlaced options added. To end the script, set the image history (saved in (1)
) to restore the image back to its original size(4)
.