Is there a way to turn negative values 32 bit image into normalized 0-1 one in Photoshop?

Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Automatically  I mean , and then make a script that do it by single  click.    My guess i could do it with a use of flat fill effect adding some positive value  then levels maybe.     But I'd like a quick universal solution  whatever  values are in  original image.

TOPICS
Actions and scripting

Views

501

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jul 13, 2022 Jul 13, 2022

I just checked and you can remap -x to +x to a normalised 0 to 1, either by channel or overall, very simply in Adobe 3D Designer using levels nodes.

'By channel' shown below with the levels settings for the blue channel shown.

 

2022-07-13_11-33-59.jpg

 

Dave

 

 

Likes

Translate

Translate
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Show an example. Where do the “negative values 32 bit image” come from?

Negative 32 bit (integer) values range from -1 to -2,147,483,648, so -1 may be 0 and -2,147,483,648 may represent 1 and any value in between may represent any fraction of value between 0 and 1 (or vice versa). But you need scripting to do that.

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Here is example. look at blue channel. it's all black  becaouse pixel values  are all in betwwen  -1 and -2 something.   and red  and green values is  in between 1 and -1 .    Can  photoshop turn  it into normalized 0-1      visiable  range somehow?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

I still don't understand.

 

Photoshop represents on screen what is in the image channels. I don't know the source of your image, but it there should some information in that channel, you probably need to write a program that reads this channels and transforms the data accordingly. For Photoshop, this is a picture with no blue channel content, and therefore it's all black. That stays all black, independent of any operation you apply.

 

If I understand well, the 32 bits colour mode is only used for HDR images and Photoshop is ill-equipped to work with those images.

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

it's not all black really.  Test the pixel values  with an eye dropper  and switch the info panel into 32-bit  floating point . You will see  -2 , -1 something  values.   So it's not all same , it's just Photoshop shows them as black.     The image is a typical  position render   from 3d animation  soft  . Blender  to be exact.  it represents two spheres  and RGB pixel valies are  position of objects surface in 3 axis coordinate system.   Blue channel is depth. 

If you put a color overlay effect/style  with some flat value and  add blending   it makes blew channel instantly visible since resulting  pixel values  comes to positive range .    I'd like to get a kind of  normalized  look  so all the pixels range would fall to 0-1.   And I couldn't figure  out the math to do it.   Perhaps  Photoshop still has an ability to do it with it's groups clipping  and blending modes representing  basic math operations.  

I understand that Photoshop is not a pro level 2d compositing soft  for complex image compositing and rather a simple photographers toy but why not give it a chance . After all it's all just a math.    All I need is a few toys to make nice collages with CG pictures in 16 bit integer mode.    And getting normalized depth is a part of it.    

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

I do not know where I should look as all I see is all black:

Abambo_0-1657474084801.png

 

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Click  at each eye-dropper  in the info panel  and a menu would open .   Select  there RGB colors  and 32bit

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

You have a different Photoshop than I have:

Abambo_0-1657475863682.png

 

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

kirkr5689_0-1657476040855.png

click it in the Info panel, not in the image

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

quote

 

I understand that Photoshop is not a pro level 2d compositing soft  for complex image compositing and rather a simple photographers toy but why not give it a chance . After all it's all just a math.   


By @kirkr5689

You're kidding? Photoshop is the reference tool.

 

But exactly, I do not understand why not taking Blender to the level you will need it. After all, it's just maths, and you have the big chance that Blender is open source.

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Well, I meant no disrespect to Photoshop . But it's not  Nuke or even After effect.   It wasn;t  designed to do a complex image compositing, mixing  computer generated images with photo or even do especially complex image editing the depth , the 3d axis in mind  .   But why not , it's flexible enough.    As of Blender it has pretty limited compositing ability too,  node based  but still pretty limited.  Photoshop has many  od its own conveniences .  

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Photoshop is a great tool for photo editing. It's not the tool I would use for a 3D animation generation. But as you are generating something in Blender, why not generating it the way you need it? The 32 bits ability of Photoshop is not very developed. You can, however, using scripting, access numerous features in Photoshop. But I think that transforming an image as you like it to get transformed, you do better to use a 3rd party program from the open-source community. Some 25 years ago, I used ImageMagick for this kind of manipulations.

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

I use a cool Photoshop plugin EXR-IO  thta allows to open exr files with layers  straight in Photoshop  and just would like to get the depth normalized  to switch to 16 bit integer mode and continue  in integers.   As you said 32 bit mode is not very developed in PSH..   It's not it's impossible to do it in Blender or other tools  I just think it should be possible to do in Photoshop too.   Just for sake of simplisity, less open/save , more straight forward  solution.

 

I have just found  that curve adjustment  does what I want , more or less,  Turns negative "blacks"   into what looks like normalized 

kirkr5689_0-1657478153255.png

almost, but I have no idea if the gamma is linear  and moreover  HOW  and why curve editor does it . Hoped somebody coud  suggest mathmatically correct solution.

 

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

quote

almost, but I have no idea if the gamma is linear  and moreover  HOW  and why curve editor does it . Hoped somebody coud  suggest mathmatically correct solution.

 

 

 


By @kirkr5689

Your curve needs to be linear for a one-to-one conversation. A curve with a slope of 45° would output the same values as the input. In your example, anything to the left will be 0 (full black). You see that your point on your curve, which is about 50% black, will be transformed to a 90+ percent black.

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied


I understand that Photoshop is not a pro level 2d compositing soft  for complex image compositing and rather a simple photographers toy but why not give it a chance . 

Would, by that logic, an excavator be a construction workers’ toy, a planer a carpenters’ toy, …? 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Well, an excavator is not easily falling into toys  category  but Phtoshop is definitly trying for  quite a few years alredy with all those AI  tools focus only.     I so dissapointed with AI after all of  its initial exitment . It works same annoying mostly as AI support in a bank .

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

You can use the "calculate" or "apply image" commands to modify the channel's pixels. It works, but I'm not sure if you can get perfect accuracy.

 

In Photoshop, the ability to work with image pixels through scripts is extremely limited.

I think you should look for another way to solve this problem.

2022-07-10_21-13-48.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

quote

In Photoshop, the ability to work with image pixels through scripts is extremely limited.

I think you should look for another way to solve this problem.


By @jazz-y

 

Save as photoshop raw. Open the file with a script. Change the data as needed. Open the modified raw file. Bingo!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

For some reason neighter my curve trick nor  your divide with 75%  works with bigger negative  depth values.  So ones I have something further upfront from zero point in world coordinates   it's no more working

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

quote

So ones I have something further upfront from zero point in world coordinates   it's no more working

 


By @kirkr5689

That's to be expected. Your curve trick sets those values to 0. You need first to determine the highest and lowest value and use that as a scale. But this also works only if the highest and lowest value are near together and all the other values are not too far away from both. What you want to do is to expand a relatively narrow range to a wider range.

 

To give you a real-world example:

You would like to look at a population of students at University, but your age scale covers the whole life span of a human, let's say from 0 to 100, when your population is only at the ages of 19 to 28.

 

ABAMBO | Hard- and Software Engineer | Photographer

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

unfortunally the trick is not working with values futher from zero

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

I have posted the exmple  : https://community.adobe.com/t5/photoshop-ecosystem-discussions/is-there-a-way-to-turn-negative-value...

  it's a position render of a biug and small spheres.   B channel  is depth  . it's all in negative  value space   aroud -40  .    I am looking  for an automated  way I could bring it to positive visiable  0-1 space to make a 16 bit integer  image.    Make an action of it  and execute whenever I need .         So I could use it with any kind of CG image of any  depth easily.    To make a FOV effect or put a mist , smoke   render  etc to a scene rendered picture.  Or to make an edge mask through hipass   to paint on worn edges .    Whatever  2d compostors  like Nuke  do for movies  , just in a single picture  and using just Photoshop.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

Have a look at Filter>3D>Generate Normal Map

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

How can it be related ?      It was most useless thing ever existed in Photoshop. To create  low quality blurry normal maps  nobody used

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

The only way to make more or less correct looking normal map in Photoshop have always been through embos filter .  Surprisingly it works on my negative height values too.   If only there would be a filter that could apply  gradient remapping  in visible values or something  to make a visible depth values

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines