Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A confused problem in the EXR to JPEG #511

Closed
hqqxyy opened this issue Jul 28, 2019 · 1 comment
Closed

A confused problem in the EXR to JPEG #511

hqqxyy opened this issue Jul 28, 2019 · 1 comment

Comments

@hqqxyy
Copy link

hqqxyy commented Jul 28, 2019

Hi,

In the document , the normalization seems not correct.

    extrema = [im.getextrema() for im in rgbf]
    darkest = min([lo for (lo,hi) in extrema])
    lighest = max([hi for (lo,hi) in extrema])
    scale = 255 / (lighest - darkest)
    def normalize_0_255(v):
        return (v * scale) + darkest
    rgb8 = [im.point(normalize_0_255).convert("L") for im in rgbf]

it might be

    extrema = [im.getextrema() for im in rgbf]
    darkest = min([lo for (lo,hi) in extrema])
    lighest = max([hi for (lo,hi) in extrema])
    scale = 255 / (lighest - darkest)
    def normalize_0_255(v):
        return (v - darkest) * scale
    rgb8 = [im.point(normalize_0_255).convert("L") for im in rgbf]

I am not sure whether it is a bug. If not, I feel sorry to bother you.

Best,

@peterhillman
Copy link
Contributor

The python "OpenEXR" module, and its documentation, is not part of this OpenEXR project: it is an independent effort. You could follow up with the developers here: https://pypi.org/project/OpenEXR/

For what it's worth, I agree with you that your proposed normalization seems more correct (issue #421 also discusses normalization of OpenEXR images)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants