If I open a raw image in Photoshop and Paintshop pro their histograms and their look is different. However, if I open a Jpeg image in both Software, then their histogram and look is the same. What does cause it? I am not familiar with photography, but, as I understood, the raw images need some sort of algorithm to apply color to them. Is it the origin of difference? How can I then apply different algorithms in Painshop pro 2018? Below are some examples for an image taken from here:
It's all to do with the profile applied to the raw files and guesses other software makes as to what that profile ought to be...
RAW is not an 'absolute' format in terms of the image displayed, it's raw data to which an 'opinion' of what the image ought to look like can be manipulated from. It will already contain several view options added by the camera, based on the photographer's pre-determined settings, but these can be changed later, in software.
Adobe RAW in Photoshop will make a guess at what it thinks the Nikon default profile ought to be and what adjustments the photographer may have made to their settings, but frankly it usually makes a horrible mess of it, because it isn't the same as Nikon actually use, it's an attempt to reverse-engineer how Nikon does it. Photoshop interprets the profile as being Adobe RGB(1998).
By the look of it, Paintshop Pro has even less of a clue as to what it really ought to look like. I don't have Paintshop to be able to examine what its guess was.
The only app that can actually guess correctly is Nikon's own software suite, including ViewNX-i. ViewNX-i knows exactly what the camera's settings were, including that the photographer was using the Vivid colour profile addition, for extra colour-punch...
To get that data into Photoshop or Paintshop correctly, the best way to do it is to export as a TIFF... then it will open looking something like it was intended, without having to make any guesses. The correct Profile is now showing as Nikon sRGB 184.108.40.20602 when imported to Photoshop.
On the other hand, the jpgs have been saved, imo [see below] directly from the camera, with the internet standard sRGB profile. This, allowing for variance in actual monitor calibration, is the closest you get to the artist's actual intent, without having Nikon software to interpret for you.
NEF interpreted by PhotoRAW
TIF after export from ViewNX-i with no adjustments
JPG, for comparison
As you can see, the TIF has more in common with the JPG, though the JPG is slightly darker in the greens.
I cant really post a picture of what the image actually looks like in ViewNX-i because the screen layout won't let me drop the size down and conveniently place the histogram over it like I can in Photoshop, but in fact the jpg is the closest of the three to what it looks like in ViewNX-i, so the camera has done a pretty decent job of conveying in a more 'portable' format [sRGB JPG] what the photographer's intent was according to his camera settings.
Raw image files contain enough data to create a near infinite number of interpretations of that data that will fit in an 8-bit jpeg file.¹ Anytime you open a raw file and look at it on your screen, you are not viewing "THE raw file." You are viewing one among countless possible interpretations of the data in the raw file. The raw data itself contains a single (monochrome) brightness value measure by each pixel well. With Bayer masked camera sensors (the vast majority of color digital cameras use Bayer filters) each pixel well has a color filter in front of it that is either red, green, or blue.² For a more complete discussion of how we get color information out of the single brightness values measured at each pixel well, please see RAW files store 3 colors per pixel, or only one?
How the image you see on your monitor when you open a raw file will look is determined by how the application you used to open the file chose to interpret the raw data in the file to produce a viewable image. Each application has its own set of default parameters that determine how the raw data is processed. One of the most significant parameters is how the white balance that is used to convert the raw data is selected. Most applications have many different sets of parameters that can be selected by the user, who is then free to alter individual settings within the set of instructions used to initially interpret the data in the raw file.
The histogram is almost always based upon the image in the form it is displayed on your screen. It is not usually based on the entire contents of the raw data contained in the file. Since the histogram measures the image as displayed on your screen, when the raw data is interpreted differently and the image looks different as displayed by the viewing application, the histogram will reflect those differences of interpretation.
¹ Sure, you could take a picture that contains a single pure color within the entire field of view. but most photos contain a wide variation of hues, tints, and brightness levels.
² Except the "red" filter is really more of a yellow-orange color, the "green" filter is more a yellowish-green color, and the "blue" filter is a violet-tinted blue color. In other words, the colors of the filters in a Bayer mask do not correspond to the three colors our RGB monitors emit and blend to reproduce the response in our retinas that many other colors do. In fact, the colors of the filters in a Bayer mask are much closer to the three colors that each of the three types of cones in our retinas are most sensitive to than they are to the three "primary" colors we use for our RGB color reproduction systems.