This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Paint Shop Pro support > February 2005 > Simple v8 script to resize and enter OK
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 |
Simple v8 script to resize and enter OK
|
|
| news frontiernet.net 2005-02-11, 11:20 pm |
| I have tried recording a script that has steps of action, the firtsrt of
which is to resize the image to a height of 100 and enter OK.
It is the process of setting the height on the resize panel and entering the
OK that I dont seem to get right. I tyhought the Height would be activatred
with an ALT-H, and a simmple enter of 100 would be correct. apprently not.
Further, I dont seem to find any awy to automate the entry of an OK on any
panel.
Is this possible? And if so, how?
| |
| Mike Williams 2005-02-12, 7:17 am |
| Wasn't it news frontiernet.net who wrote:
>I have tried recording a script that has steps of action, the firtsrt of
>which is to resize the image to a height of 100 and enter OK.
>
>It is the process of setting the height on the resize panel and entering the
>OK that I dont seem to get right. I tyhought the Height would be activatred
>with an ALT-H, and a simmple enter of 100 would be correct. apprently not.
It works for me in PSP 8.1 when running in Interactive mode. What goes
wrong for you?
>Further, I dont seem to find any awy to automate the entry of an OK on any
>panel.
Arrange for the steps where you don't require user input to be in Silent
mode.
Click on the "Edit Selected Script" icon and you'll see that all the
steps are initially in Default mode. Change them to Silent or
Interactive as required.
"Silent" means that the panel will not be displayed and the values
used will be those from when the script was created.
"Interactive" means that the panel will be displayed and the user can
change values then enter OK (except for steps marked as "Not
Editable", for which there is no panel).
"Default" means that the step can be either Silent or Interactive,
depending on the "interactive Script Playback Toggle".
--
Mike Williams
Gentleman of Leisure
| |
| news frontiernet.net 2005-02-12, 6:20 pm |
| I am having a hard time getting these concepts clear.
The actions I am trying to automate can be run from the keyboard with
alt-I
alt_Z
alt-H
100
ENTER
But when I record the as a script, it stops at the resize panel display.
If I choose to edit the script, I see the following (tilde where a check
mark would be)
~ Interactive EnableOptimizeScriptUndo(not editable)
~ Interactive Resize
If I change the Interactive entry on each line to either Default, or Silent
and save it, the script will still stop with the display of the Resize
panel.
I suspect I am missing the point of an important conept here somewhere.
How do you record either those simple keyboard shortcuts, or the full
keyboard ation and get it to play WITHOUT stoppping at the Resiza Panel?
"Mike Williams" <nospam@econym.demon.co.uk> wrote in message
news:ZPjVsJA9aYDCFwoC@econym.demon.co.uk...
> Wasn't it news frontiernet.net who wrote:
the[color=darkred]
activatred[color=darkred]
not.[color=darkred]
>
> It works for me in PSP 8.1 when running in Interactive mode. What goes
> wrong for you?
>
any[color=darkred]
>
> Arrange for the steps where you don't require user input to be in Silent
> mode.
>
> Click on the "Edit Selected Script" icon and you'll see that all the
> steps are initially in Default mode. Change them to Silent or
> Interactive as required.
>
> "Silent" means that the panel will not be displayed and the values
> used will be those from when the script was created.
>
> "Interactive" means that the panel will be displayed and the user can
> change values then enter OK (except for steps marked as "Not
> Editable", for which there is no panel).
>
> "Default" means that the step can be either Silent or Interactive,
> depending on the "interactive Script Playback Toggle".
>
> --
> Mike Williams
> Gentleman of Leisure
| |
| Samantha 2005-02-12, 6:20 pm |
|
"news frontiernet.net" <rfrohrer@rconnect.com> wrote in message
news:pKtPd.367$6p7.233@news01.roc.ny...
>I am having a hard time getting these concepts clear.
>
> The actions I am trying to automate can be run from the keyboard with
> alt-I
> alt_Z
> alt-H
> 100
> ENTER
>
> But when I record the as a script, it stops at the resize panel display.
>
> If I choose to edit the script, I see the following (tilde where a check
> mark would be)
> ~ Interactive EnableOptimizeScriptUndo(not editable)
> ~ Interactive Resize
>
> If I change the Interactive entry on each line to either Default, or
> Silent
> and save it, the script will still stop with the display of the Resize
> panel.
>
> I suspect I am missing the point of an important conept here somewhere.
>
> How do you record either those simple keyboard shortcuts, or the full
> keyboard ation and get it to play WITHOUT stoppping at the Resiza Panel?
> "Mike Williams" <nospam@econym.demon.co.uk> wrote in message
> news:ZPjVsJA9aYDCFwoC@econym.demon.co.uk...
> the
> activatred
> not.
> any
>
>
| |
| Samantha 2005-02-12, 6:20 pm |
| Try this script.
from JascApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'Paint Shop Pro 9',
'Host Version': u'9.01'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})
# Resize
App.Do( Environment, 'Resize', {
'AspectRatio': 2.32642,
'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels,
'CurrentResolutionUnits':
App.Constants.ResolutionUnits.PixelsPerIn,
'Height': 100,
'MaintainAspectRatio': True,
'Resample': True,
'ResampleType': App.Constants.ResampleType.Bicubic,
'ResizeAllLayers': True,
'Resolution': 72,
'Width': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})
S
"news frontiernet.net" <rfrohrer@rconnect.com> wrote in message
news:pKtPd.367$6p7.233@news01.roc.ny...
>I am having a hard time getting these concepts clear.
>
> The actions I am trying to automate can be run from the keyboard with
> alt-I
> alt_Z
> alt-H
> 100
> ENTER
>
> But when I record the as a script, it stops at the resize panel display.
>
> If I choose to edit the script, I see the following (tilde where a check
> mark would be)
> ~ Interactive EnableOptimizeScriptUndo(not editable)
> ~ Interactive Resize
>
> If I change the Interactive entry on each line to either Default, or
> Silent
> and save it, the script will still stop with the display of the Resize
> panel.
>
> I suspect I am missing the point of an important conept here somewhere.
>
> How do you record either those simple keyboard shortcuts, or the full
> keyboard ation and get it to play WITHOUT stoppping at the Resiza Panel?
> "Mike Williams" <nospam@econym.demon.co.uk> wrote in message
> news:ZPjVsJA9aYDCFwoC@econym.demon.co.uk...
> the
> activatred
> not.
> any
>
>
| |
| Kris Zaklika 2005-02-12, 11:15 pm |
| "news frontiernet.net" wrote:
>
> I am having a hard time getting these concepts clear.
What actually do you want this script to do? Earlier you wrote
that you want to "to resize the image to a height of 100". A
hundred what? Percent, inches, pixels? Do you want to maintain
the aspect ratio of the image or not? Do you want to resize
every image to a height of 100 somethings irrespective of
aspect ratio and retaining that aspect ratio? Or, do you want
to resize only one dimension of the image and keep the other
unchanged?
> The actions I am trying to automate can be run from the keyboard with
> alt-I
> alt_Z
> alt-H
> 100
> ENTER
Yes, but that is irrelevant. What you are actually doing is
creating the parameters for a PSP command and are placing
that command with its parameters into the script. In this
case it is the Image > Resize command. All the other settings
in the dialog are also involved in the command and what you set
them to makes a difference to how the command executes. You've
said nothing about these other settings or about the purpose
of the script. If your units are set to Percent, then typing
100 into the command is specifying an operation that potentially
does nothing depending on the state of the Lock Aspect Ratio
checkbox.
> But when I record the as a script, it stops at the resize panel display.
If you set the command to Silent using the Edit Selected Script
button the dialog for the command will not appear (with the
possible exception of the case where there is an error in the
command).
> If I choose to edit the script, I see the following (tilde where a check
> mark would be)
> ~ Interactive EnableOptimizeScriptUndo(not editable)
> ~ Interactive Resize
>
> If I change the Interactive entry on each line to either Default, or Silent
> and save it, the script will still stop with the display of the Resize
> panel.
It doesn't when I do it. If I tell it to execute silently then
no dialog appears when the script is executed after recording
has been completed.
> I suspect I am missing the point of an important conept here somewhere.
>
> How do you record either those simple keyboard shortcuts, or the full
> keyboard ation and get it to play WITHOUT stoppping at the Resiza Panel?
Remember that you are not dealing with a macro recorder. You
aren't recording keystrokes. You are recording commands along
with all their parameters. You can easily check what you have
recorded by opening the script in a text editor like Notepad
to see what is in there. Just don't change the spaces since
Python is sensitive to white space.
[color=darkred]
> "Mike Williams" <nospam@econym.demon.co.uk> wrote in message
> news:ZPjVsJA9aYDCFwoC@econym.demon.co.uk...
> the
> activatred
> not.
> any
| |
| news frontiernet.net 2005-02-12, 11:15 pm |
| I will try that.
But, the idea was for me to learn how to RECORD these actions withe the
mouse or keyboard shortcuts.
In the late 80's Lotus 1-2-3 had a macro recording process that was a lot
more inuitive than this seems to be. This is Twenty years later.
I want to learn how to record values ( like height ) on a panel like the
Resize panel and reccord the action of the ENTER key too.
Is this so diffficult that one needs to be a Python programmer to do it?
"Samantha" <samantha7395@hotmail.com> wrote in message
news:ZIednbeAYt9IHpPfRVn-rA@adelphia.com...
> Try this script.
>
>
> from JascApp import *
>
> def ScriptProperties():
> return {
> 'Author': u'',
> 'Copyright': u'',
> 'Description': u'',
> 'Host': u'Paint Shop Pro 9',
> 'Host Version': u'9.01'
> }
>
> def Do(Environment):
> # EnableOptimizedScriptUndo
> App.Do( Environment, 'EnableOptimizedScriptUndo', {
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Default,
> 'AutoActionMode': App.Constants.AutoActionMode.Match,
> 'Version': ((9,0,1),1)
> }
> })
>
> # Resize
> App.Do( Environment, 'Resize', {
> 'AspectRatio': 2.32642,
> 'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels,
> 'CurrentResolutionUnits':
> App.Constants.ResolutionUnits.PixelsPerIn,
> 'Height': 100,
> 'MaintainAspectRatio': True,
> 'Resample': True,
> 'ResampleType': App.Constants.ResampleType.Bicubic,
> 'ResizeAllLayers': True,
> 'Resolution': 72,
> 'Width': None,
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match,
> 'Version': ((9,0,1),1)
> }
> })
>
> S
> "news frontiernet.net" <rfrohrer@rconnect.com> wrote in message
> news:pKtPd.367$6p7.233@news01.roc.ny...
of[color=darkred]
entering[color=darkred]
Silent[color=darkred]
>
>
| |
| news frontiernet.net 2005-02-12, 11:15 pm |
| I had assumed that all the other parameters would stay at default with the
exception of the width which would recalc sine I have the aspect ration set.
Does one need to set ALL the parameters on the Resize Panel for it to work?
"Kris Zaklika" <Kris.Zaklika@corel.com> wrote in message
news:420E8D4D.B1BFDB3F@corel.com...[color=darkred]
> "news frontiernet.net" wrote:
>
> What actually do you want this script to do? Earlier you wrote
> that you want to "to resize the image to a height of 100". A
> hundred what? Percent, inches, pixels? Do you want to maintain
> the aspect ratio of the image or not? Do you want to resize
> every image to a height of 100 somethings irrespective of
> aspect ratio and retaining that aspect ratio? Or, do you want
> to resize only one dimension of the image and keep the other
> unchanged?
>
>
> Yes, but that is irrelevant. What you are actually doing is
> creating the parameters for a PSP command and are placing
> that command with its parameters into the script. In this
> case it is the Image > Resize command. All the other settings
> in the dialog are also involved in the command and what you set
> them to makes a difference to how the command executes. You've
> said nothing about these other settings or about the purpose
> of the script. If your units are set to Percent, then typing
> 100 into the command is specifying an operation that potentially
> does nothing depending on the state of the Lock Aspect Ratio
> checkbox.
>
>
> If you set the command to Silent using the Edit Selected Script
> button the dialog for the command will not appear (with the
> possible exception of the case where there is an error in the
> command).
>
Silent[color=darkred]
>
> It doesn't when I do it. If I tell it to execute silently then
> no dialog appears when the script is executed after recording
> has been completed.
>
>
> Remember that you are not dealing with a macro recorder. You
> aren't recording keystrokes. You are recording commands along
> with all their parameters. You can easily check what you have
> recorded by opening the script in a text editor like Notepad
> to see what is in there. Just don't change the spaces since
> Python is sensitive to white space.
>
of[color=darkred]
entering[color=darkred]
on[color=darkred]
Silent[color=darkred]
can[color=darkred]
| |
| Kris Zaklika 2005-02-13, 4:15 am |
| "news frontiernet.net" wrote:
>
> I had assumed that all the other parameters would stay at default with the
> exception of the width which would recalc sine I have the aspect ration set.
You still don't seem to appreciate that units matter. If
you type 100% it means "don't resize". You still haven't
explained what you really want the script to do. This
makes it hard to give you the solution you want.
> Does one need to set ALL the parameters on the Resize Panel for it to work?
All parameters are recorded whether you change them or
not, but some combination of parameters make no sense and
other combinations of parameters can't be recorded. For
example, suppose while you are recording you have Lock
Aspect Ratio checked and you type 100 pixels for Height.
The Width setting is automatically computed from the
aspect ratio as, say, 301 pixels. What gets recorded to
the script is a height of 100, a width of 301 and the
state of the Lock Aspect Ratio checkbox. Now you run the
script on another image with an aspect ratio not 1:3.01
but 1:1. What should happen? Are you telling the program
to resize the image unconditionally to the recorded height
and width values of 100 and 300 pixels? Or, are you telling
it to ignore that and keep the aspect ratio of your image?
If so, which do you want - a height of 100 or a width of
301 pixels - since you can't have both? You cannot record
a script to do this last thing. You must hand edit it
to mark one of height or width as undefined so that it will
be computed at execution time from the aspect ratio. The
way to make something undefined is to replace the number
recorded to the script with "None" (without the double quotes).
It is considerations like this that prompted me to ask you
what you were actually trying to accomplish. Unbeknownst to
you, you are writing a Python program. This is extremely
powerful (permitting conditional execution and interweaving
with operating system calls) but it is also not always as
trivial as recording a few strokes without knowing the
capabilities of PSP. Recording the effects of filters is
easy. Recording resizing is trickier because of the conditional
situation I described. Manipulating tools is trickier still.
There is a Thumbnail_150 script that comes with PSP that
creates thumbnails fitting exactly in a 150 x 150 pixel
box irrespective of aspect ratio. You can look inside this
script to get an idea of how this is done.
[color=darkred]
> "Kris Zaklika" <Kris.Zaklika@corel.com> wrote in message
> news:420E8D4D.B1BFDB3F@corel.com...
> Silent
> of
> entering
> on
> Silent
> can
| |
| Mike Williams 2005-02-13, 7:14 am |
| Wasn't it news frontiernet.net who wrote:
>I had assumed that all the other parameters would stay at default with the
>exception of the width which would recalc sine I have the aspect ration set.
>
>Does one need to set ALL the parameters on the Resize Panel for it to work?
No, but the script records *everything* that's in the panel at the time
you recorded it. It doesn't record which of the settings were the
defaults and which ones you changed.
In particular this means that the width doesn't get recalculated. If you
run the script on an image that has a different aspect ratio, the
recorded script will change the aspect ratio to that which you recorded.
It doesn't appear to be possible to get PSP to automatically calculate
the width from the height. If you edit the script to remove the "Width"
setting that was recorded, then it will use the previously used value of
width from the last time you performed a resize operation.
The only way to arrange for the width to be recalculated is to write
your own Python code into the script to perform the calculation, similar
to the calculations performed in Thumbnail_150.PspScript.
--
Mike Williams
Gentleman of Leisure
| |
| news frontiernet.net 2005-02-13, 11:18 pm |
| I am trying to spped up a process I am using to select individual classmate
photos out of a full page scanned image, do some adjusting and then and end
up with an image of a specific height which will be exported throught the
JPG compressor. Then the last step of naming the file to be saved I could do
from the mouse oe keyboard.
By hand I do these logical steps;
1) do the selection of the specific classmate from the full page image. Each
lassmate may have a slightly different sized selected area
2) copy the selection
3) paste the selection as a new image
4) do a resize of the image, setting the height to 100 pixels and letting
the height recalc letting the other values at their defaults
5) do an Adjust Brightness & Contrast Automatic Contrast & Enhanement. I
accept all the defaults
6) do an Adjust Shrpness Sharpen
7) do a File Export JPG Optimizer function accepting the prest compression
of 15
8) I name the file by finding other classmater photos and appending the
letters "_med": to the classmate photo usually just to the left of the ".",
but this step I did not want to automate becasue it does vary
These step an be done with Keyboard shortcuts except the panel "OK". So, I
assumed these would be eisily recordable.and I could speed up this lengthy
process. But I could not find a keyboard shortcut for "OK" and could not
find anything in the HELP facility on how to automate "OK".
I assumed, apperently in error, that the width would recalc on the automated
process the same as it does on the manual process. Mike mentined the use ofd
the word "NONE" in the width field. Is the word "NONE" a way to get a script
to recalc one of the image dimensions based on the other and the aspect
ration?
Each of these classmate images are slightly different in size as I lift them
off the original scanned image of the yearbook. I need them to be of a
certain VERTICAL size ( here 100 pixels).
I want to thank you guys for opening my eyes to and gettiing my mind into
this deeper.
"Mike Williams" <nospam@econym.demon.co.uk> wrote in message
news:5Pn2fAATVxDCFwct@econym.demon.co.uk...
> Wasn't it news frontiernet.net who wrote:
the[color=darkred]
set.[color=darkred]
work?[color=darkred]
>
> No, but the script records *everything* that's in the panel at the time
> you recorded it. It doesn't record which of the settings were the
> defaults and which ones you changed.
>
> In particular this means that the width doesn't get recalculated. If you
> run the script on an image that has a different aspect ratio, the
> recorded script will change the aspect ratio to that which you recorded.
>
> It doesn't appear to be possible to get PSP to automatically calculate
> the width from the height. If you edit the script to remove the "Width"
> setting that was recorded, then it will use the previously used value of
> width from the last time you performed a resize operation.
>
> The only way to arrange for the width to be recalculated is to write
> your own Python code into the script to perform the calculation, similar
> to the calculations performed in Thumbnail_150.PspScript.
>
> --
> Mike Williams
> Gentleman of Leisure
| |
| Samantha 2005-02-13, 11:18 pm |
| See if you can use/modify this script.. The script needs to be in the
trusted folder since it is saving a file.
Run the script after you do the selection.
S
###### Start copy
from JascApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'Paint Shop Pro',
'Host Version': u'8.10'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
})
# Copy
App.Do( Environment, 'Copy', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# PasteGraphicAsNewImage
App.Do( Environment, 'PasteGraphicAsNewImage', {
'CreateFromDropData': App.Constants.Boolean.false,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# SelectDocument
App.Do( Environment, 'SelectDocument', {
'SelectedImage': 0,
'Strict': App.Constants.Boolean.false,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# Resize
App.Do( Environment, 'Resize', {
'AspectRatio': None,
'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels,
'CurrentResolutionUnits':
App.Constants.ResolutionUnits.PixelsPerIn,
'Height': 100,
'MaintainAspectRatio': App.Constants.Boolean.true,
'Resample': App.Constants.Boolean.true,
'ResampleType': App.Constants.ResampleType.Bicubic,
'ResizeAllLayers': App.Constants.Boolean.true,
'Resolution': 72,
'Width': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
}
})
# Auto Contrast Enhancement
App.Do( Environment, 'AutoContrastEnhancement', {
'Appearance': App.Constants.Appearance.Natural,
'Bias': App.Constants.ContrastBias.Neutral,
'Strength': App.Constants.ContrastStrength.Normal,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# Sharpen
App.Do( Environment, 'Sharpen', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# JPEG Optimizer
App.Do( Environment, 'JPEGOptimizer', {
'Format': App.Constants.JpegFormat.Standard,
'Compression': 15,
'FileName': None,
'BackgroundColor': (255,255,255),
'ChromaSubSampling':
App.Constants.ChromaSubSampling.YCC_2x2_1x1_1x1,
'SaveExifData': App.Constants.Boolean.false,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
######## end copy
"news frontiernet.net" <rfrohrer@rconnect.com> wrote in message
news:I9KPd.422$6p7.185@news01.roc.ny...
>I am trying to spped up a process I am using to select individual
>classmate
> photos out of a full page scanned image, do some adjusting and then and
> end
> up with an image of a specific height which will be exported throught the
> JPG compressor. Then the last step of naming the file to be saved I could
> do
> from the mouse oe keyboard.
>
> By hand I do these logical steps;
> 1) do the selection of the specific classmate from the full page image.
> Each
> lassmate may have a slightly different sized selected area
> 2) copy the selection
> 3) paste the selection as a new image
> 4) do a resize of the image, setting the height to 100 pixels and letting
> the height recalc letting the other values at their defaults
> 5) do an Adjust Brightness & Contrast Automatic Contrast & Enhanement. I
> accept all the defaults
> 6) do an Adjust Shrpness Sharpen
> 7) do a File Export JPG Optimizer function accepting the prest compression
> of 15
> 8) I name the file by finding other classmater photos and appending the
> letters "_med": to the classmate photo usually just to the left of the
> ".",
> but this step I did not want to automate becasue it does vary
>
> These step an be done with Keyboard shortcuts except the panel "OK". So, I
> assumed these would be eisily recordable.and I could speed up this lengthy
> process. But I could not find a keyboard shortcut for "OK" and could not
> find anything in the HELP facility on how to automate "OK".
>
> I assumed, apperently in error, that the width would recalc on the
> automated
> process the same as it does on the manual process. Mike mentined the use
> ofd
> the word "NONE" in the width field. Is the word "NONE" a way to get a
> script
> to recalc one of the image dimensions based on the other and the aspect
> ration?
>
> Each of these classmate images are slightly different in size as I lift
> them
> off the original scanned image of the yearbook. I need them to be of a
> certain VERTICAL size ( here 100 pixels).
>
> I want to thank you guys for opening my eyes to and gettiing my mind into
> this deeper.
>
> "Mike Williams" <nospam@econym.demon.co.uk> wrote in message
> news:5Pn2fAATVxDCFwct@econym.demon.co.uk...
> the
> set.
> work?
>
>
| |
| Kris Zaklika 2005-02-13, 11:18 pm |
| "news frontiernet.net" wrote:
>
> I am trying to spped up a process I am using to select individual classmate
> photos out of a full page scanned image, do some adjusting and then and end
> up with an image of a specific height which will be exported throught the
> JPG compressor. Then the last step of naming the file to be saved I could do
> from the mouse oe keyboard.
>
> By hand I do these logical steps;
> 1) do the selection of the specific classmate from the full page image. Each
> lassmate may have a slightly different sized selected area
The above is best done interactively rather than in a script.
The rest is scriptable but you have to pay attention to the
Resize step as explained below.
> 2) copy the selection
> 3) paste the selection as a new image
> 4) do a resize of the image, setting the height to 100 pixels and letting
> the height recalc letting the other values at their defaults
After recording your script with Lock Aspect Ratio checked,
Height = 100 pixels, Width = whatever was calculated from the
aspect ratio, open the script in Notepad. Carefully replace
the number after the Width parameter of the Resize command
with the word None. The Resize command will begin with:
App.Do( Environment, 'Resize',
and you want to change, for example:
'Width': 999,
to:
'Width': None,
without changing any of the white space. Samantha posted an
example of this. After this edit, when you run the script it
will apply a Height of 100 pixels but, finding the Width
undefined and Lock Aspect Ratio on, it will compute the Width
setting from the aspect ratio of the image.
> 5) do an Adjust Brightness & Contrast Automatic Contrast & Enhanement. I
> accept all the defaults
> 6) do an Adjust Shrpness Sharpen
> 7) do a File Export JPG Optimizer function accepting the prest compression
> of 15
If you are always using the same compression setting it will
be quicker to use File > Save As and select the JPEG format.
Before running the script make sure that when you press the
Options button in this dialog with the format set to JPEG the
listed compression setting is 15. For a small image of 100
pixels in height you will get the best quality JPEG image if
you make sure chroma subsampling is set to 1x1 1x1 1x1, and
the image will be smaller if you elect not to save the EXIF
information.
> 8) I name the file by finding other classmater photos and appending the
> letters "_med": to the classmate photo usually just to the left of the ".",
> but this step I did not want to automate becasue it does vary
>
> These step an be done with Keyboard shortcuts except the panel "OK". So, I
> assumed these would be eisily recordable.
Please look at the process differently. You are placing
complete PSP commands in a script. It does not matter how you
specify the parameters of the command. You can type them
directly into a script, you can record them based on mouse
clicks, you can record them based on hotkeys, you can tab
your way through dialogs. None of this detail matters.
The formulation of a command with its associated parameters
is not complete until OK is pressed in a dialog or a mouse
movement is finished in a tool. Before this stage, no
command is recorded. After this stage, the complete command
is recorded. You can't start a command, go off and do
something else, and then complete the command by pressing
OK. The script is not keeping a running commentary on your
actions in the program. For example, it does not record that
you changed your mind six times about the width of the image
you wanted. Instead, it waits to see what you really want
to do and records that. Only the last choice of width setting
appears in the script and the resize to a particular width
only appears in the script because you pressed OK (meaning,
"yes, I really want to apply this command with these
parameter settings". This is quite different from a macro
recorder that blindly records every move you make. A script
is not a macro.
(There is one place where a script *appears* to echo your
every move, and that is with changes to layer properties.
Each change is an individual PSP command but if you do
several of them in succession as you hunt for the best setting
you may get the feeling "why didn't PSP just choose the last
thing I did?". None of this affects your current activities.)
> and I could speed up this lengthy
> process. But I could not find a keyboard shortcut for "OK" and could not
> find anything in the HELP facility on how to automate "OK".
Perhaps my explanation has cleared up for you that you are
not recording keystrokes and therefore there is no way to
record "OK".
> I assumed, apperently in error, that the width would recalc on the automated
> process the same as it does on the manual process. Mike mentined the use ofd
> the word "NONE" in the width field. Is the word "NONE" a way to get a script
> to recalc one of the image dimensions based on the other and the aspect
> ration?
I think I mentioned it. I've described above in detail how
to do it and I've explained in a previous post why it is
necessary to resort to this. BTW, write None, not NONE.
> Each of these classmate images are slightly different in size as I lift them
> off the original scanned image of the yearbook. I need them to be of a
> certain VERTICAL size ( here 100 pixels).
That is what my suggestion will achieve.
> I want to thank you guys for opening my eyes to and gettiing my mind into
> this deeper.
No problem. Just keep focused on the fact that you are
writing powerful mini-programs, not recording keystrokes.
[color=darkred]
> "Mike Williams" <nospam@econym.demon.co.uk> wrote in message
> news:5Pn2fAATVxDCFwct@econym.demon.co.uk...
> the
> set.
> work?
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|