Applying perimeter gradient script for jpg batch processing

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
ATV123
Posts: 15
Joined: Mon Sep 22, 2014 7:35 am
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Applying perimeter gradient script for jpg batch processing

Post by ATV123 »

I'll try to make this short and sweet and not list off all the dead ends I've come across. See the below images. I want to know if this can be accomplished by PSP and if so how. The first jpg is what is started with. Note that the perimeter, the dark gray area, is composed of light and dark pixels. The second jpg is the desired end product. The pixels immediately around the outside of the stamp are unchanged but they gradually transition (within about the space of around 8 to ten pixels) to an even dark gray color. This is what is needed. The only stipulation is that the processed used to achieve this cannot use any manual selection, this is because I need to script the process so that it can be automated to work on different sized stamps and used in batch processing. Can anyone help?
Attachments
Starting image
Starting image
Completed image
Completed image
photodrawken
Posts: 684
Joined: Wed Sep 26, 2012 8:40 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16Gb
Hard_Drive_Capacity: 324Gb
Location: USA

Re: Applying perimeter gradient script for jpg batch process

Post by photodrawken »

My first question is why do you need to have that transition area around the stamp instead of just a solid dark grey background? That transition area doesn't add anything to the image, IMO.

I'd look into scripting a colour selection for the background, specifying contiguous and a Tolerance of about 25. Then your script could fill that selection with your desired background colour.
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
ATV123
Posts: 15
Joined: Mon Sep 22, 2014 7:35 am
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Applying perimeter gradient script for jpg batch process

Post by ATV123 »

Quick answer to your first question - It's complicated and I need it this way.

Regarding the color selection that is a manual process is it not, where I select an area using the magic wand? If so that cannot be automated can it? Also I'm looking for a gradual blend and I'm not sure if the process you're describing would accomplish that.
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Applying perimeter gradient script for jpg batch process

Post by LeviFiction »

So long as the background is always a straight color and the edges are easily identifiable, and you're guaranteed a couple pixels in a certain position on the image, you can auto-mate using the magic wand tool.

Scripts will record where on the image you clicked. So it's best if the area you click is in the upper left area of the image since this will be image size independent. So as long as you've got that border like you show in the example here, I'd say you're golden.
https://levifiction.wordpress.com/
photodrawken
Posts: 684
Joined: Wed Sep 26, 2012 8:40 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16Gb
Hard_Drive_Capacity: 324Gb
Location: USA

Re: Applying perimeter gradient script for jpg batch process

Post by photodrawken »

ATV123 wrote:Quick answer to your first question - It's complicated and I need it this way.
Not to belabor the point, but in your previous thread you described needing the transitional gradient so that there's no awkward "line" between the background of the stamp and the colour of your Web page.

Unless that mixed colour background of your scanned stamps has a special significance in the field of stamp collecting, why not simply have your script delete the selected background and save the image as a PNG image which preserves transparency?

Such an image will look just fine whether the Web page background is black, or any variation of colour:
Image 2.png
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
ATV123
Posts: 15
Joined: Mon Sep 22, 2014 7:35 am
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Applying perimeter gradient script for jpg batch process

Post by ATV123 »

Drawken thanks but PNGs are much larger is size. I need JPGs.

Levi thanks could you define, step by step, this process that accomplish what you're talking about?
ATV123
Posts: 15
Joined: Mon Sep 22, 2014 7:35 am
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Applying perimeter gradient script for jpg batch process

Post by ATV123 »

Drawken, also the image you provided has very nice edges on the stamp perfs. That is, they neither look intruded on and they don't have little remnants of the background. Was the accomplished in PSP in a way that could be automated or did you have to spend a couple minutes cleaning it up etc?
photodrawken
Posts: 684
Joined: Wed Sep 26, 2012 8:40 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16Gb
Hard_Drive_Capacity: 324Gb
Location: USA

Re: Applying perimeter gradient script for jpg batch process

Post by photodrawken »

ATV123 wrote:Drawken thanks but PNGs are much larger is size. I need JPGs.
Yes, PNGs are much larger. An option would be to save the image as a WebP image which would be less than half the size of the PNG; but support for that format is dicey -- I couldn't get IE11 to show them.

Alternatively, you could always set the PSP background colour to the colour of your Web page background before deleting the scanned background. That will fill the removed image background with your Web background and the result could be saved as a JPG....
Last edited by photodrawken on Wed Oct 01, 2014 7:28 pm, edited 2 times in total.
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
photodrawken
Posts: 684
Joined: Wed Sep 26, 2012 8:40 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16Gb
Hard_Drive_Capacity: 324Gb
Location: USA

Re: Applying perimeter gradient script for jpg batch process

Post by photodrawken »

ATV123 wrote:Drawken, also the image you provided has very nice edges on the stamp perfs. That is, they neither look intruded on and they don't have little remnants of the background. Was the accomplished in PSP in a way that could be automated or did you have to spend a couple minutes cleaning it up etc?
It can definitely be automated.

I used the Magic Wand with a Tolerance value of "50", clicking on a spot about halfway between the upper left stamp corner and the upper left image corner to select most of the background. Then I used Selection...Modify...Expand to expand the selection by 1 pixel to get rid of the last of the background clinging to the edges of the stamp. That also seemed to remove the "holes" in the selection, but to be safe I used Selection...Modify...Remove Specks and Holes. Then I promoted the background layer to a "normal" layer so that deleting the selection would leave a transparent area instead of filling that deleted selection with the PSP background colour.
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
ATV123
Posts: 15
Joined: Mon Sep 22, 2014 7:35 am
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Applying perimeter gradient script for jpg batch process

Post by ATV123 »

"It can definitely be automated....I used the Magic Wand with a Tolerance value of "50"....

I see, thanks. Question, though - Wouldn't this first step be a manual operation, i.e. wouldn't I have to manually do this for every stamp and not be able to include this in a script?
photodrawken
Posts: 684
Joined: Wed Sep 26, 2012 8:40 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16Gb
Hard_Drive_Capacity: 324Gb
Location: USA

Re: Applying perimeter gradient script for jpg batch process

Post by photodrawken »

ATV123 wrote:Wouldn't this first step be a manual operation, i.e. wouldn't I have to manually do this for every stamp and not be able to include this in a script?
Read LeviFiction's reply. I don't use PSP much at all, so record a test script and test it out on a couple of images.
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
Post Reply