Resize image by file dimension

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

Moderators: xbytor, DavideBarranca, Paul MR

lglmrc

Resize image by file dimension

Postby lglmrc » Thu Aug 25, 2011 10:11 am

Hello,
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

xbytor

Resize image by file dimension

Postby xbytor » Thu Aug 25, 2011 4:41 pm

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.

-X

txuku

Resize image by file dimension

Postby txuku » Thu Aug 25, 2011 5:37 pm

Bonjour

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


Return to “Photoshop Scripting: Code Snippets”

Who is online

Users browsing this forum: No registered users and 1 guest