Save for Web (vb)

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

nevets2001uk

Save for Web (vb)

Post by nevets2001uk »

I'm writing some vbscripts to automate my photoshop workflow and have hit a problem with the save for web functionality.

I need to be able to save a file to be under a certain size limit such as 100Kb. Manually I would use Save for Web to do this but with scripting in CS2 can't find a way to do this.

I'm afraid I can only code in vb so any sample code would need to be in that format (unless anyone knows of a convertor!). I tried script listener but I don't really understand it and it doesn't seem to calculate for the file size with each new image.

Any work around for this would be greatly appreciated.

Many Thanks,
Steve
Andrew

Save for Web (vb)

Post by Andrew »

Hi Steve, I don't use VB but I can answer your question. This has been a much discussed topic at the Adobe forum and there is no effective way to use scripting to target a given file size with SFW. You can save a file look at the file size and save again but that is a very cumbersome process.

While I understand the problem I think there are good arguments for targeting a quality level rather than a file size - because file size is a function of image detail which can vary considerably. If you target a quality level that delivers a similar average file size it might give better overall results. More importantly, it can be done .

Andrew
nevets2001uk

Save for Web (vb)

Post by nevets2001uk »

Thanks Andrew.

I had thought about doing the save and check method when trying to think of a suitable way to achieve my aim but ruled it out because, as you say, it is very inefficient and slow.

The reason I need to attempt this is that some of the places to which I uplaod my images have an image filesize restriction. I'm automating the process of resizing, sharpening and then saving the images for these sites but need to ensure that I get the best quality while still being under the required filesize limits.

I may end up using the method you described to do a save, check and delete loop or having to keep this stage a manual process!

Thanks,
Steve