Resize image by file dimension

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: Kukurykus, Tom, xbytor


Resize image by file dimension

Post by lglmrc »

I'm wondering if it is possible to resize an image by its file size with Extendscript?

For example:
my original image is a .psd file with this dimension: 11.985.384 bytes
I want to scale it down to, let's say, this dimension: 5.000.000 bytes

Is this possible?

I mean: does exist any sintax in Extendscript that refers to the bytes or something similar?

I use Photoshop CS3, but I think the sintax may be the same also for CS5

Any suggestions would be much appreciated
Thanks in advance


Resize image by file dimension

Post by xbytor »

You would have to save it as a jpg or some other file format that has lossy compression.
Even then, you would have to iterate over jpeg quality levels until you found one
that gave you the desired file size. Several of us have implemented this over the years
and you may be able to find an implementation on this site somewhere.



Resize image by file dimension

Post by txuku »


Or - in psd format - reducing the size of the work incrementally ?