Copy link to clipboard
Copied
Hello, i need to create a Photoshop JavaScript script that will reduce the quality based on a given file size.
Lets say i have a 800x800 resolution PNG image that is 700kb.
How can i script it as to tell Photoshop to Export the file a 800x800 JPG file around 200kb.
The file size doesnt have to be 100% exact. It can be plus or minus 7kb -> 207kb or mb -> 193mb.
Important thing is i have to tell Photoshop via JavaScript ExtendScript to reduce the quality based on the size i give it.
Any help would be appreciated.
Copy link to clipboard
Copied
There have been scripts posted the do what you want. The problem is the post may no longer be available post over three years old are not longer available on this changed site. And this site search has its problems. A script most likely can not predict how well a particular image will compress at some jpeg image quality setting. A script would most likely need to use "save as" jpeg at a high image quality then examine the size of the saved file. If to large save over the file lowering the jpeg quality till the output file falls within you criteria.
Photoshop Save for Web feature seems to be able to estimate what output file size will be produces at an image quality setting. However, I do not know if a script can set and retrieve fields in Photoshop Save to web dialog. Look at the sizes shown in the 4up save for web tab the the different quality settings..
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now