This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > PainShop Pro Scripting > June 2007 > How to script savings of a series of images from a multilayer image
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 |
How to script savings of a series of images from a multilayer image
|
|
|
| I have one v8 psp image that is a layered creation of heading text &
objects over one of a series of common background images that are also in
layers.
I want to script the creation of the 20 or so headers that I presently have
to do step by step.
But, I am a simple script user.
I thought it might be as simple as scripting it once, then using COPY/PASTE
with editing to select the right layers and designate the right output file
name.
It, apparently, is not that simple.
I cannot see any way to script which layers are on and which layers are off.
Here is the script that was recorded from keyboard and mouse actions
============================================
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', {
})
# LayerSetVisibility
App.Do( Environment, 'LayerSetVisibility', {
'Command': App.Constants.ShowCommands.Hide,
'Path': (0,1,[],App.Constants.Boolean.false),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default
}
})
# LayerSetVisibility
App.Do( Environment, 'LayerSetVisibility', {
'Command': App.Constants.ShowCommands.Show,
'Path': (0,1,[],App.Constants.Boolean.false),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default
}
})
# JPEG Optimizer
App.Do( Environment, 'JPEGOptimizer', {
'Format': App.Constants.JpegFormat.Standard,
'Compression': 15,
'FileName': u'E:\\_header\\root_1000x128.jpg',
'BackgroundColor': (255,255,255),
'ChromaSubSampling': App.Constants.ChromaSubSampling.YCC_2x2_1x1_1x1,
'SaveExifData': App.Constants.Boolean.false,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
================
How would this be modified to add selection of which layers were on and
which were off?
| |
| SuzShook 2007-06-12, 10:18 pm |
| I don't think I understand exactly what you want to do. Can you explain
more fully? There is a way to detect whether a layer is visible or not - is
that what you mean by "on" or "off"? There is also a script available from
Joe Fromm, formerly of Jasc, Inc., which will make separate images from all
the layers in an image. But I don't think that's what you're looking for.
How are you determining the file name for the save - does it correspond to
the layer name? I think you will have to be much more explicit in what you
want to do so we can give you some help. Give it another try! Suz
rfr wrote:
> I have one v8 psp image that is a layered creation of heading text &
> objects over one of a series of common background images that are
> also in layers.
>
> I want to script the creation of the 20 or so headers that I
> presently have to do step by step.
>
> But, I am a simple script user.
>
> I thought it might be as simple as scripting it once, then using
> COPY/PASTE with editing to select the right layers and designate the
> right output file name.
>
> It, apparently, is not that simple.
>
> I cannot see any way to script which layers are on and which layers
> are off.
> Here is the script that was recorded from keyboard and mouse actions
> ============================================
> 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', {
>
>
> })
>
> # LayerSetVisibility
>
> App.Do( Environment, 'LayerSetVisibility', {
>
> 'Command': App.Constants.ShowCommands.Hide,
>
> 'Path': (0,1,[],App.Constants.Boolean.false),
>
> 'GeneralSettings': {
>
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
>
> 'AutoActionMode': App.Constants.AutoActionMode.Default
>
> }
>
> })
>
> # LayerSetVisibility
>
> App.Do( Environment, 'LayerSetVisibility', {
>
> 'Command': App.Constants.ShowCommands.Show,
>
> 'Path': (0,1,[],App.Constants.Boolean.false),
>
> 'GeneralSettings': {
>
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
>
> 'AutoActionMode': App.Constants.AutoActionMode.Default
>
> }
>
> })
>
> # JPEG Optimizer
>
> App.Do( Environment, 'JPEGOptimizer', {
>
> 'Format': App.Constants.JpegFormat.Standard,
>
> 'Compression': 15,
>
> 'FileName': u'E:\\_header\\root_1000x128.jpg',
>
> 'BackgroundColor': (255,255,255),
>
> 'ChromaSubSampling': App.Constants.ChromaSubSampling.YCC_2x2_1x1_1x1,
>
> 'SaveExifData': App.Constants.Boolean.false,
>
> 'GeneralSettings': {
>
> 'ExecutionMode': App.Constants.ExecutionMode.Default,
>
> 'AutoActionMode': App.Constants.AutoActionMode.Match
>
> }
>
> })
>
> ================
>
> How would this be modified to add selection of which layers were on
> and which were off?
| |
|
| I keep all the images for my web site headers in a psp image that is a
series of overlays of Text, etc with shadows for each topical section, over
a common background.
All the headers will be created against the same background.
I have stored in the same image, nearly 100 possiblr background images.
Each time I want to change the header background for each of the sections of
my website, I create a header for each section by selecting the layer(
background) I want from the master image and make it visible and select the
specific topic text layer and then use COPY MERGE and the JPG optimizer and
save that created image to a specific file name such as
"weather_1000x128.jpg" in a specific folder. Then when I am done creating
all the headers, I move them to the server.
The result is one header image per section of the website. They are all
stored in a floder off the root of the server.
I chose this method rather than using ONE common background image and gif
overlays because of the resolution difference and because I cannot get the
text shadows to look good against all the background images that I have
amongs my choices.
I considered using PNG overlays, rather than GIF overlays. But, I cannot
seem to master making the PNG transparency work on all browsers. I have
tried and failed.
So, each time I want to change the look and feel of my headers with a new
background, I do this process twenty some times, once for each section of my
web site.
I would like to automate this process. It seemed logically simple to me. I
thought I could record the process for one header and then duplicate it and
merely use the script editing process to change which layers were visible
and the target file name.
But, when I record the process, tho I see where I can specify the output
file name, I see no reference as to which layers were visible and which were
not visible.
So, I asked if it was possible to alter that script and specifiy which image
layers were visible prior to the COPY MERGE step.
Perhaps this is an advanced Python tpoic ( I hope not). Perhaps this is not
possible.
A simple 3 background - 3 section concept version of my maste image layer
use is like this;
layer 7 Worthington name
layer 6 Recreation
layer 5 Community Information
layer 4 Weather text
layer 3 background 3
layer 2 background 2
layer 1 background 1
As an example, for the Weather header, Layer 7, Layer 4, and one of the 3
background layers are visible. The other layers are hidden. I then run the
creation process I described above and save the resulting file as I
described above.
"SuzShook" <suzshook@roadrunner.com> wrote in message
news:466dd58d$1_3@cnews...
>I don't think I understand exactly what you want to do. Can you explain
>more fully? There is a way to detect whether a layer is visible or not -
>is that what you mean by "on" or "off"? There is also a script available
>from Joe Fromm, formerly of Jasc, Inc., which will make separate images
>from all the layers in an image. But I don't think that's what you're
>looking for. How are you determining the file name for the save - does it
>correspond to the layer name? I think you will have to be much more
>explicit in what you want to do so we can give you some help. Give it
>another try! Suz
>
> rfr wrote:
>
>
| |
| SuzShook 2007-06-13, 6:25 pm |
| I think perhaps I'm following you now. You want several scripts of the same
type, each selecting and making visible different layers in this multi-layer
image, so you can save to a new image with each. If I'm understanding you
correctly, you could use the following. This code first hides all layers,
then moves to the bottomost layer, and then selects the 7th layer up from
the bottom and makes it visible (the bottom layer would be 0, the next
layer, 1, etc., so this code selects the 7th layer counting up from the
bottom, or the 8th layer overall):
# LayerViewNone
App.Do( Environment, 'LayerViewNone', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# SelectLayer
App.Do( Environment, 'SelectLayer', {
'Path': (0,-9999,[],App.Constants.Boolean.false),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# SelectLayer
App.Do( Environment, 'SelectLayer', {
'Path': (0,7,[],App.Constants.Boolean.false),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# LayerSetVisibility
App.Do( Environment, 'LayerSetVisibility', {
'Command': App.Constants.ShowCommands.Show,
'Path': (0,0,[],False),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default
}
})
You would have to include the last 3 steps for each layer you want to
select, always starting at the bottom and finding the layer wanted. Once
you've selected all the layers you want and made them visible, you could
then add the Copy Merge and JPEG Optimizer steps. This is one way to do it.
The script could be made much more complex, allowing you to search for a
layer by name, but this would involve more coding. Let me know if this
helps, rfr. Suz
rfr wrote:[color=darkred]
> I keep all the images for my web site headers in a psp image that is
> a series of overlays of Text, etc with shadows for each topical
> section, over a common background.
>
> All the headers will be created against the same background.
>
> I have stored in the same image, nearly 100 possiblr background
> images.
> Each time I want to change the header background for each of the
> sections of my website, I create a header for each section by
> selecting the layer( background) I want from the master image and
> make it visible and select the specific topic text layer and then use
> COPY MERGE and the JPG optimizer and save that created image to a
> specific file name such as "weather_1000x128.jpg" in a specific
> folder. Then when I am done creating all the headers, I move them to
> the server.
> The result is one header image per section of the website. They are
> all stored in a floder off the root of the server.
>
> I chose this method rather than using ONE common background image and
> gif overlays because of the resolution difference and because I
> cannot get the text shadows to look good against all the background
> images that I have amongs my choices.
>
> I considered using PNG overlays, rather than GIF overlays. But, I
> cannot seem to master making the PNG transparency work on all
> browsers. I have tried and failed.
>
> So, each time I want to change the look and feel of my headers with a
> new background, I do this process twenty some times, once for each
> section of my web site.
>
> I would like to automate this process. It seemed logically simple to
> me. I thought I could record the process for one header and then
> duplicate it and merely use the script editing process to change
> which layers were visible and the target file name.
>
> But, when I record the process, tho I see where I can specify the
> output file name, I see no reference as to which layers were visible
> and which were not visible.
>
> So, I asked if it was possible to alter that script and specifiy
> which image layers were visible prior to the COPY MERGE step.
>
> Perhaps this is an advanced Python tpoic ( I hope not). Perhaps this
> is not possible.
>
> A simple 3 background - 3 section concept version of my maste image
> layer use is like this;
> layer 7 Worthington name
> layer 6 Recreation
> layer 5 Community Information
> layer 4 Weather text
> layer 3 background 3
> layer 2 background 2
> layer 1 background 1
>
> As an example, for the Weather header, Layer 7, Layer 4, and one of
> the 3 background layers are visible. The other layers are hidden. I
> then run the creation process I described above and save the
> resulting file as I described above.
>
> "SuzShook" <suzshook@roadrunner.com> wrote in message
> news:466dd58d$1_3@cnews...
| |
|
| Since I plan to be adding more layers and most of these will not be at the
top end, a script functioning on RELATIVE POSITION will generate the wrong
results ( unless I alter the script each time I add material).
Is there a way to use layer NAME ( it might be called DESCRIPTION) instead
of RELATIVE POSITION from the bottom as the means to identify the layer?
"SuzShook" <suzshook@roadrunner.com> wrote in message
news:466ef793_1@cnews...
>I think perhaps I'm following you now. You want several scripts of the
>same type, each selecting and making visible different layers in this
>multi-layer image, so you can save to a new image with each. If I'm
>understanding you correctly, you could use the following. This code first
>hides all layers, then moves to the bottomost layer, and then selects the
>7th layer up from the bottom and makes it visible (the bottom layer would
>be 0, the next layer, 1, etc., so this code selects the 7th layer counting
>up from the bottom, or the 8th layer overall):
>
> # LayerViewNone
> App.Do( Environment, 'LayerViewNone', {
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Default,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
>
> # SelectLayer
> App.Do( Environment, 'SelectLayer', {
> 'Path': (0,-9999,[],App.Constants.Boolean.false),
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
>
> # SelectLayer
> App.Do( Environment, 'SelectLayer', {
> 'Path': (0,7,[],App.Constants.Boolean.false),
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
>
> # LayerSetVisibility
> App.Do( Environment, 'LayerSetVisibility', {
> 'Command': App.Constants.ShowCommands.Show,
> 'Path': (0,0,[],False),
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Default
> }
> })
>
> You would have to include the last 3 steps for each layer you want to
> select, always starting at the bottom and finding the layer wanted. Once
> you've selected all the layers you want and made them visible, you could
> then add the Copy Merge and JPEG Optimizer steps. This is one way to do
> it. The script could be made much more complex, allowing you to search for
> a layer by name, but this would involve more coding. Let me know if this
> helps, rfr. Suz
>
> rfr wrote:
>
>
| |
| SuzShook 2007-06-13, 6:25 pm |
| Yes, you could search through all the layers, and when you find the layer
name you want, make that layer visible. I'll work up that code for you, and
post it when I get it done. Suz
rfr wrote:[color=darkred]
> Since I plan to be adding more layers and most of these will not be
> at the top end, a script functioning on RELATIVE POSITION will
> generate the wrong results ( unless I alter the script each time I
> add material).
> Is there a way to use layer NAME ( it might be called DESCRIPTION) instead
> of RELATIVE POSITION from the bottom as the means to identify
> the layer?
> "SuzShook" <suzshook@roadrunner.com> wrote in message
> news:466ef793_1@cnews...
| |
| SuzShook 2007-06-13, 6:25 pm |
| underprocessable | |
| SuzShook 2007-06-13, 6:25 pm |
| underprocessable | |
|
|
|
|
| SuzShook 2007-06-14, 6:22 pm |
| underprocessable |
|
|
| | Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |
|