Groups > Corel > Corel Paint Shop Pro Scripting > Re: colour of pixel (1,1) into ResizeCanvas




colour of pixel (1,1) into ResizeCanvas

colour of pixel (1,1) into ResizeCanvas
Thu, 03 Apr 2008 16:51:16 -040
I'm trying to put together a script that will
resize the canvas of any image smaller than 32x32,
with the original image in the center --
I was able to figure that much out
by recording such an operation,
then editing out the image-specific information --
*and* setting the colour of the added pixels
to the colour of pixel 1,1.

Seems like the eyedropper tool would be useful somehow,
but I can't figure out how to convey the information
picked up by the eyedropper to the ResizeCanvas function/method.

Post Reply
Re: colour of pixel (1,1) into ResizeCanvas
Thu, 3 Apr 2008 19:12:33 -0400
Question - are the images you are resizing single-layer images?  If so, the 
attached script will do the trick, expanding the canvas using the color 
found in pixel (1,1).  To pick up that color in the Resize step, the image 
has to be flattened, but the script can do that to the images if they are 
single-layer images.  If the images are not single-layer, you might not want 
to flatten them, so another method can be employed.  The attached script 
will not flatten a multi-layer image, but will generate a message in the 
Script Output palette saying "This script will only work for single-layer 
images."  Of course, I did not know what you were resizing the image to, so

you will have to replace the parameters in the Resize step to those you 
want.  Be careful, however, to leave the FillColor parameter as coded, 
though - that's what's picking up the color saved from pixel (1,1):
        'FillColor': Material1['Color'],
GIve this a try, JustMe, and let me know if this works for you.  Suz
-- 
Suz Shook
C-Tech Volunteer
JustMe wrote:
> I'm trying to put together a script that will
> resize the canvas of any image smaller than 32x32,
> with the original image in the center --
> I was able to figure that much out
> by recording such an operation,
> then editing out the image-specific information --
> *and* setting the colour of the added pixels
> to the colour of pixel 1,1.
>
> Seems like the eyedropper tool would be useful somehow,
> but I can't figure out how to convey the information
> picked up by the eyedropper to the ResizeCanvas function/method.
>
> Help? 
Post Reply
Re: colour of pixel (1,1) into ResizeCanvas
Mon, 07 Apr 2008 01:52:11 -040
SuzShook wrote:

> GIve this a try, JustMe, and let me know if this works for you.  Suz

THAT worked!  Thank you!

Oddly, it did the same thing I was trying to avoid the first few times
that I tried it -- it would wind up using the (or *a*) foreground colour,
or maybe just the complement of the background colour, instead of the
background colour.  And then on about the 4th or 5th try, it worked fine,
Post Reply
about | contact