Convert hdr image to non-hdr image

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
dkrikun0
Posts: 5
Joined: 2019-06-24T03:19:56-07:00
Authentication code: 1152

Convert hdr image to non-hdr image

Post by dkrikun0 » 2019-06-24T03:23:48-07:00

Hi,

I would like to convert an HDR (i.e in NetPFM format) image to non-HDR image (i.e. NetPGM).
The conversion needs to be "viewer-friendly", that is the resulting image needs be contrast, without cutting off information etc.

How could I achieve this with ImageMagick 7.0.8 Q16, with HDRI?

Thanks!

snibgo
Posts: 11787
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert hdr image to non-hdr image

Post by snibgo » 2019-06-24T06:06:01-07:00

Does "-auto-level" do what you want? If not, please link to a sample input, and say what output you want.
snibgo's IM pages: im.snibgo.com

dkrikun0
Posts: 5
Joined: 2019-06-24T03:19:56-07:00
Authentication code: 1152

Re: Convert hdr image to non-hdr image

Post by dkrikun0 » 2019-06-24T07:37:43-07:00

I've tried
`magick src.pfm -auto-level src.pgm`

Now both feh and sxiv say src.pgm is broken, is there something else?

snibgo
Posts: 11787
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert hdr image to non-hdr image

Post by snibgo » 2019-06-24T07:44:29-07:00

Please link to a sample input.
snibgo's IM pages: im.snibgo.com

dkrikun0
Posts: 5
Joined: 2019-06-24T03:19:56-07:00
Authentication code: 1152

Re: Convert hdr image to non-hdr image

Post by dkrikun0 » 2019-06-24T07:51:33-07:00

magick rose: rose.pfm
magick rose.pfm -auto-level rose.pgm

snibgo
Posts: 11787
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert hdr image to non-hdr image

Post by snibgo » 2019-06-24T08:31:58-07:00

It seems that IM is writing rose.pgm as 32 bits/channel. (Just one channel, of course.) Gimp can't read the result.

If we insert "-depth 16" before writing, Gimp can read it fine.

Does that help?
snibgo's IM pages: im.snibgo.com

dkrikun0
Posts: 5
Joined: 2019-06-24T03:19:56-07:00
Authentication code: 1152

Re: Convert hdr image to non-hdr image

Post by dkrikun0 » 2019-06-25T00:49:58-07:00

Almost, had to use -depth 8, for feh/sxiv.
Do I still need -auto-level?

snibgo
Posts: 11787
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert hdr image to non-hdr image

Post by snibgo » 2019-06-25T03:49:12-07:00

dkrikun0 wrote:The conversion needs to be "viewer-friendly", that is the resulting image needs be contrast, without cutting off information etc.
I don't really understand your question. Perhaps "-auto-level" does what you want.
snibgo's IM pages: im.snibgo.com

Post Reply