Editing Tools: Arithmetic Command

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
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

Editing Tools: Arithmetic Command

Post by photodrawken »

LeviFiction wrote: 3) Preview window for Arithmetic command. Having to accept the change then start over when it's not quite what I want is very annoying.
You're the only person I've seen who admits to using the Arithmetic functions. :wink: Out of curiosity, what do you use them for?
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
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: Editing Tools: Arithmetic Command

Post by LeviFiction »

Mostly for mask creation and channel mixing.
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: Editing Tools: Arithmetic Command

Post by photodrawken »

LeviFiction wrote:Mostly for mask creation and channel mixing.
Would you give an example of each? Because I still don't understand how the Arithmetic functions can create something that can't be achieved with other tools (such as the Channel Mixer)....
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
User avatar
Ken Berry
Site Admin
Posts: 22481
Joined: Fri Dec 10, 2004 9:36 pm
operating_system: Windows 11
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte B550M DS3H AC
processor: AMD Ryzen 9 5900X
ram: 32 GB DDR4
Video Card: AMD RX 6600 XT
Hard_Drive_Capacity: 1 TB SSD + 2 TB HDD
Monitor/Display Make & Model: Kogan 32" 4K 3840 x 2160
Corel programs: VS2022; PSP2023; DRAW2021; Painter 2022
Location: Levin, New Zealand

Re: Editing Tools: Arithmetic Command

Post by Ken Berry »

Just an explanatory note here. This conversation was taking place in the Wish List for X9 thread. I thought it deserved a separate thread of its own, given that it is a substantive issue in its own right, and otherwise distracted from what was meant to be a general wish list for improvements to the program in the next version.
Ken Berry
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: Editing Tools: Arithmetic Command

Post by LeviFiction »

That's why I responded to him in a PM after my initial response. xD

Thank you for moving it out.
https://levifiction.wordpress.com/
Kathy_9
Site Admin
Posts: 2896
Joined: Tue Nov 30, 2010 12:44 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
processor: 8th Generation Intel Core i7 8700 3 20 GHz
ram: 16GB
Video Card: NVIDIA GeForce RTX 2060 [6 GB GDDR6 dedicated]
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP EliteDisplay E243m 23.8-inch
Corel programs: PSPX2 ~2023; Painter 2018~23
Location: USA
Contact:

Re: Editing Tools: Arithmetic Command

Post by Kathy_9 »

Thanks Ken. An interesting topic for sure than others can enjoy apart from the wish list.
PSPX9 | PSP2020 | PSP2021| PSP2022 | PSP2023 & PhotoMirage installed; PSPX | PSPX2 thru PSP2019 owned but not installed
http://www.flickr.com/photos/37153430@N03/
User avatar
Ken Berry
Site Admin
Posts: 22481
Joined: Fri Dec 10, 2004 9:36 pm
operating_system: Windows 11
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte B550M DS3H AC
processor: AMD Ryzen 9 5900X
ram: 32 GB DDR4
Video Card: AMD RX 6600 XT
Hard_Drive_Capacity: 1 TB SSD + 2 TB HDD
Monitor/Display Make & Model: Kogan 32" 4K 3840 x 2160
Corel programs: VS2022; PSP2023; DRAW2021; Painter 2022
Location: Levin, New Zealand

Re: Editing Tools: Arithmetic Command

Post by Ken Berry »

LeviFiction wrote:That's why I responded to him in a PM after my initial response. xD

Thank you for moving it out.
It might be useful for others if you could post the substantive parts of your PM to photodrawken here.
Ken Berry
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: Editing Tools: Arithmetic Command

Post by LeviFiction »

PSP actually has a very nice explanation of all of the Arithmetic options in its help pages. It's under the title of "Combining Images."

Now, for the most part there are a number of features in this command that have already been replaced by layers. Such as "multiply" and "Difference" or "lightest" and "Darkest" for combining images. So this command is really only useful for the features that haven't been duplicated yet. And for creating greyscale images that you can use in the creation of masks and selections.


To start out the dialog gives you two drop down boxes. One for image #1, and one for image #2. Image #1 will determine the size of the final image. Also the order in which the two images are placed will determine the result of the calculations like Subtract and Difference.

The only functions that people might be a bit confused on are Binary AND, OR and XOR (Exclusive OR).

So quick introduction to those concepts. Each channel in an image is a greyscale representation of 256 values between 0-255. These numbers can be represented in binary by 8 digits. Each digit can be either a 0 or a 1. Let's take two random numbers. 128 from Image #1, and 220 from Image #2. Written out in binary they look like this.

10000000 = 128
11011100 = 220

The rules for AND, OR, and XOR are simple. Each digit corresponds to the same digit right below it. With AND if both the top and bottom digit are "1" then the result is "1" so they are both "true." Any other combination and the result is zero. So let's and these two numbers. The only digit that is true on both the top and the button is the first digit. All others will result in a zero.

10000000 = 128
11011100 = 220
-------------------
10000000 = 128

OR only requires that one of the compared digits is equal to 1. If both digits are zero then the result is zero. All other combinations result in a 1.

10000000 = 128
11011100 = 220
------------------
11011100 = 220

XOR - means that only one of the two digits can be set to '1" if both the top and bottom are set to "1" then the result is "zero" if they are both zero then the result is zero.

10000000 = 128
11011100 = 220
-------------------
01011100 = 92

You can test this out for yourself. Create a blank image and fill it with a medium grey (128) and create a second image and fill that with a light grey (220). Then use the arithmetic command with AND, OR, and XOR and test the result.


Next is Divisor. Divisor will divide the result of the function by whatever value you have set. This value by default is set to '1'. So it won't change the result at all. But increase it to 2 and you halve the result.

Bias is an offset. Bias gets added to the final result after Divisor has had it's way. You can do this to bias the result up or down. The default is zero for no change.

Finally there is Clip colors. Clip colors is used to make sure that the final result of all of these calculations is within the range of 0-255. If clip is turned on then any number set below zero will simply become zero. Any number above 255 will be set to 255.

If clip is turned off, however, PSP the cycles the result around. So if the result is less than zero, PSP will add 256 to the result. And if it's greater than 255 PSP will subtract 256. The result is that white jumps back down to black and black jumps around to white. So you can create a lot of interesting results with this.

The big problem is that, for the most part especially with a full tonal image you won't know exactly how two images or channels will interact. So you have to play around with it. Which is very long, very tedious, very boring. And sometimes you don't even end up with a good result.

I like the command. I use it when I have various masks to create or combine, but it takes a long time for me to come up with a good result.
https://levifiction.wordpress.com/
User avatar
Ken Berry
Site Admin
Posts: 22481
Joined: Fri Dec 10, 2004 9:36 pm
operating_system: Windows 11
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte B550M DS3H AC
processor: AMD Ryzen 9 5900X
ram: 32 GB DDR4
Video Card: AMD RX 6600 XT
Hard_Drive_Capacity: 1 TB SSD + 2 TB HDD
Monitor/Display Make & Model: Kogan 32" 4K 3840 x 2160
Corel programs: VS2022; PSP2023; DRAW2021; Painter 2022
Location: Levin, New Zealand

Re: Editing Tools: Arithmetic Command

Post by Ken Berry »

Thanks LeviFiction.... now where's my calculator?? :shock:
Ken Berry
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: Editing Tools: Arithmetic Command

Post by photodrawken »

Ken Berry wrote:Just an explanatory note here. This conversation was taking place in the Wish List for X9 thread. I thought it deserved a separate thread of its own, given that it is a substantive issue in its own right, and otherwise distracted from what was meant to be a general wish list for improvements to the program in the next version.
Good idea, Ken. Thanks.
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: Editing Tools: Arithmetic Command

Post by photodrawken »

LeviFiction,
Mucho thanks for the explanations of the logical operators -- I've been too lazy to study the concepts.... :wink:

Now, my first questions about the Arithmetic functions: Are they only useful for 8 bit-per-pixel images? What happens if 16bpp or 32bpp images (where pixel values > 256 are possible) are used? Are the functions somehow "hacked" to get a result? Or are the Arithmetic functions simply disabled for those images?

Seems to me that the binary representations of those large pixel values can still be manipulated as you described, and that the only problem will be with that "Clip" setting. Am I correct?
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
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: Editing Tools: Arithmetic Command

Post by LeviFiction »

Have you ever noticed that even when you set an image to 16-bit you still can only select a maximum RGB value of 255?

Anyway, I don't know how it gets around that issue. My first thought is that it temporarily converts the colors back to 8-bit, performs the calculation, then writes out the 16-bit equivalent on the new image. Running the exact same process that I described above I get the exact same RGB value that I did originally when using XOR. 92.

But if I manually perform an XOR on the 16-bit color values the result is different enough to be noticeable. So the method works on 16-bit images but the results are not what you would get if it worked on the 16-bit values directly.
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: Editing Tools: Arithmetic Command

Post by photodrawken »

LeviFiction wrote:Have you ever noticed that even when you set an image to 16-bit you still can only select a maximum RGB value of 255?
Actually, with PhotoLine I can set the values beyond that (whether the units are percent, byte, hex, or float). I don't understand what that means, so I'll need to post a question to the developers about that....

Back to the Arithmetic command: I've been reading quite a few tutorials I found by searching for "Photoshop image calculations", and it seems that the uses of that tool (which is the same as the PSP "Arithmetic" function) fall into two categories -- creating masks and converting a colour image to B&W. To be honest, both those uses can be accomplished by separating the appropriate colour channels into layers in an image and applying layer blend modes. The advantage to using layers that way is that you'll have a live preview of what's happening.

As far as I've been able to determine, that "Calculations" function in Photoshop predates PS's use of layers, so it seems pretty much superfluous now, I think....

I think I posted a tutorial here a long time ago which translated a PS tutorial to PSP, using Calculations/Arithmetic. I think it dealt with creating a frequency separation set of layers for portrait retouching. If I can find that tutorial, I'll see if it can be done without using Arithmetic.
Ken
Yes, I think it can be eeeeeasily done...
Just take everything out on Highway 61.
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: Editing Tools: Arithmetic Command

Post by LeviFiction »

You know, I started off my explanation saying that very thing
Now, for the most part there are a number of features in this command that have already been replaced by layers. Such as "multiply" and "Difference" or "lightest" and "Darkest" for combining images. So this command is really only useful for the features that haven't been duplicated yet. And for creating greyscale images that you can use in the creation of masks and selections.
But there are some things that layers do not do. Namely Add, Subtract, Average, and the Binary combinations. Technically the use of a divisor and offset are bound to come in handy somewhere down the line but I won't hold my breath.

Calculations in Photoshop has a few distinct advantages over PSP. 1) It can create an alpha channel directly from the dialog and 2) It can use all of the blend options already available to layers. PSP's arithmetic command doesn't look like it's been touched in years. and 3) Photoshop's Calculations command auto previews on the image you're working on so you know what the results are right away.
https://levifiction.wordpress.com/
shotsniffer
Posts: 1
Joined: Thu Aug 27, 2015 4:19 pm
operating_system: Windows 7 Home Premium
System_Drive: C
32bit or 64bit: 64 Bit

Re: Editing Tools: Arithmetic Command

Post by shotsniffer »

Hi,

I bought PSP in place of PhotoShop or other tools, hoping it had good 16 bit or float operations on images, since I practice astrophotography, once in a while.

I had a bad surprise, realizing that PSP does not, in spite of so many years this software is around !!!

I hope that this lack of precision will be soon filled, because who uses raw formats nowadays uses floating point for processing, many free sw processing image software do already this.

Hope this helps ...
Post Reply