This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > PainShop Pro Scripting > May 2006 > JPEGOptimizer directory





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author JPEGOptimizer directory
Big Bad Dave

2006-05-07, 6:58 am

Hi

Does anyone know how to tell the JPEGOptimizer function where to save a
file. I'm writing a script that brings up the JPEG optimizer dialog box
with various default settings. When you click OK, the SaveAs dialog box
comes up but it defaults to the last directory that you saved anything in,
not the directory that the file came from. It does get the file name part
correct, but ignores the rest of the 'FileName' argument. Any suggestions?

Thanks

Dave


Fred Hiltz

2006-05-07, 6:59 pm

Big Bad Dave wrote:
> Does anyone know how to tell the JPEGOptimizer function
> where to save a file. I'm writing a script that brings up
> the JPEG optimizer dialog box with various default
> settings. When you click OK, the SaveAs dialog box comes
> up but it defaults to the last directory that you saved
> anything in, not the directory that the file came from. It
> does get the file name part correct, but ignores the rest
> of the 'FileName' argument. Any suggestions?


I have never seen a way to script that. A possible alternative would
be to run your script to set up the Optimizer, then process the
photos with the Batch Processor, which uses the settings last
established for the Save As options, but lets the user set the
output folder once for the batch.

Your note implies that you want to over-write the files that were
opened for editing. Most of us rarely do that and never encourage
anyone to destroy their originals. This is especially harmful with
JPG, which degrades the image--however slightly--every time you
save. Every time!

You may well have good reasons to overrule the conventional wisdom
here. I thought it worth mentioning for others who may be reading.
--
Fred Hiltz, fhiltz at yahoo dot com



SuzShook

2006-05-07, 6:59 pm

If you run that step silently, it will save the file to the directory listed
in the FileName parameter of the command. If you want that to be the same
as the directory from which the file came, you can extract that information
from the file itself using the ReturnImageInfo:

ImageInfo = App.Do( Environment, 'ReturnImageInfo')

# JPEG Optimizer
App.Do( Environment, 'JPEGOptimizer', {
'Format': App.Constants.JpegFormat.Standard,
'Compression': 10,
'FileName': ImageInfo [ 'FileName' ],
'BackgroundColor': (255,255,255),
'ChromaSubSampling':
App.Constants.ChromaSubSampling.YCC_2x2_1x1_1x1,
'SaveExifData': App.Constants.Boolean.false,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

This would do it, Dave - however, I don't think it can be done if you want
to run that step interactively. Suz
--
Suz Shook
C-Tech Volunteer


Big Bad Dave wrote:
> Hi
>
> Does anyone know how to tell the JPEGOptimizer function where to save
> a file. I'm writing a script that brings up the JPEG optimizer
> dialog box with various default settings. When you click OK, the
> SaveAs dialog box comes up but it defaults to the last directory that
> you saved anything in, not the directory that the file came from. It
> does get the file name part correct, but ignores the rest of the
> 'FileName' argument. Any suggestions?
> Thanks
>
> Dave



JoeB

2006-05-08, 4:01 am

"Big Bad Dave" <dave@hotmail.com> wrote in news:445db059$1_2
@cnews:

> Hi
>
> Does anyone know how to tell the JPEGOptimizer function where

to save
> a file. I'm writing a script that brings up the JPEG optimizer

dialog
> box with various default settings. When you click OK, the

SaveAs
> dialog box comes up but it defaults to the last directory that

you
> saved anything in, not the directory that the file came from.



If you really want it to save in the directory the file came
from, then I'm just here to suggest that you read - then re-read
- what Fred said. Saving a jpg into the same directory it came
from - without changing the filename before saving - will degrade
your image so I can see no reason for doing so. In fact, there
is little reason to re-save anything as a jpg unless you need it
for something like email or a web page. Otherwise, saves should
be done in a lossless format. Voluntarily degrading your
work/images is not a recommended course of action.

Regards,

JoeB





> It does
> get the file name part correct, but ignores the rest of the

'FileName'
> argument. Any suggestions?
>
> Thanks
>
> Dave
>
>


Big Bad Dave

2006-05-08, 4:01 am

Thanks for the quick response everyone.
You're right Fred, I never overwrite the original image. I usually just put
an 'a' before the '.jpg' (DSCN1234a.jpg). Actually, that's probably the
best thing to do. I'll make the script strip off the .jpg, then add the
'a.jpg' before running the optimizer silently.
Dave

"JoeB" <myemail@yahoo.com> wrote in message
news:Xns97BCE0608C07AJoeB@216.191.232.194...
> "Big Bad Dave" <dave@hotmail.com> wrote in news:445db059$1_2
> @cnews:
>
> to save
> dialog
> SaveAs
> you
>
>
> If you really want it to save in the directory the file came
> from, then I'm just here to suggest that you read - then re-read
> - what Fred said. Saving a jpg into the same directory it came
> from - without changing the filename before saving - will degrade
> your image so I can see no reason for doing so. In fact, there
> is little reason to re-save anything as a jpg unless you need it
> for something like email or a web page. Otherwise, saves should
> be done in a lossless format. Voluntarily degrading your
> work/images is not a recommended course of action.
>
> Regards,
>
> JoeB
>
>
>
>
>
> 'FileName'
>



Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews