Multiplying 2 HDR Q32 image result in Q8 output

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
f2b
Posts: 12
Joined: 2016-04-02T14:01:02-07:00
Authentication code: 1151

Multiplying 2 HDR Q32 image result in Q8 output

Post by f2b »

Hi, i use IM Q16 HDRI

when i multiply two HDR (each 32bit/channel) it results in a 8bit image... It's saved in 32bit but pixelx values no more exceed 1.0 :(. Bright values are all clamped to 1.0

here is my command

magick -gravity center image1.hdr image2.hdr -compose Multiply -composite -define quantum:format=floating-point -depth 32 result.hdr

Thanks for you help
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multiplying 2 HDR Q32 image result in Q8 output

Post by snibgo »

For compositions, values are first normalized to nominal 0.0 to 1.0, by dividing by QuantumRange, then un-normalized afterwards. For example:

Code: Select all

f:\web\im>%IMG7%magick xc:gray(50%) xc:gray(25%) -compose Multiply -composite txt:

# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (8191.88,8191.88,8191.88)  #200020002000  srgb(12.5%,12.5%,12.5%)
This ensures the result is the same, whatever the Q-number.

Does that explain the problem?
snibgo's IM pages: im.snibgo.com
f2b
Posts: 12
Joined: 2016-04-02T14:01:02-07:00
Authentication code: 1151

Re: Multiplying 2 HDR Q32 image result in Q8 output

Post by f2b »

if i understand you, you are saying that it shoud works, but i can't see what's wrong with my command :/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multiplying 2 HDR Q32 image result in Q8 output

Post by snibgo »

"-composite" will clamp at 0% and 100% unless you include "-define compose:clamp=off".
snibgo's IM pages: im.snibgo.com
f2b
Posts: 12
Joined: 2016-04-02T14:01:02-07:00
Authentication code: 1151

Re: Multiplying 2 HDR Q32 image result in Q8 output

Post by f2b »

oh yeah, it works! You are the boss! ;)

thank you very much :)
Post Reply