question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NativeJpegTranscoder does not properly support wide color gamut images

See original GitHub issue

Description

what you did:load a wide color image

private void loadImage(Uri uri, SimpleDraweeView simpleDraweeView) {
        Log.e("jiyun_test", "loadImage:" + uri);
        ImageRequest request = getImageRequest(uri, simpleDraweeView);

        PipelineDraweeController controller = (PipelineDraweeController)
                Fresco.newDraweeControllerBuilder()
                        .setImageRequest(request)
                        .setOldController(simpleDraweeView.getController())
                        // other setters as you need
                        .build();
        simpleDraweeView.setController(controller);
    }
public ImageRequest getImageRequest(Uri uri, SimpleDraweeView simpleDraweeView) {
        int width;
        int height;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
            width = simpleDraweeView.getWidth();
            height = simpleDraweeView.getHeight();
        } else {
            width = simpleDraweeView.getMaxWidth();
            height = simpleDraweeView.getMaxHeight();
        }
    
        ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
       
        if (width > 0 && height > 0) {
            builder.setResizeOptions(new ResizeOptions(width, height));
        }
        
        builder.setProgressiveRenderingEnabled(true);
        return builder.build();
    }

expected: The color shown in the picture is normal actually happens:The color shown in the picture is abnormal

Reproduction

[FILL THIS OUT: How can we reproduce the bug? Provide URLs to relevant images if possible, or a sample project

.]

Solution

[OPTIONAL: Do you know what needs to be done to address this issue? Ideally, provide a pull request which fixes this issue.]

Additional Information

Delete the following code, the problem is solved:

 if (width > 0 && height > 0) {
            builder.setResizeOptions(new ResizeOptions(width, height));
        }
  • Fresco version: [FILL THIS OUT] implementation ‘com.facebook.fresco:fresco:0.12.0’
  • Platform version: [FILL THIS OUT: specific to a particular Android version? Device?] android 10.0 pixel

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jiyun9901commented, Apr 29, 2020

SimpleImageTranscoderFactory test is OK! but why the code can work well? Could you explain it in detail,tks!

0reactions
oprisnikcommented, May 27, 2020

Thanks for the detailed report @jiyun9901. Do you also have a suggested fix / pull request that you would like to put forward?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Examples of various wide-gamut images - WebKit
Below are example images to demonstrate wide-gamut. There are multiple versions of each image: one in sRGB, then some in other color spaces...
Read more >
Intro to wide color gamut and HDR in Compressor
Intro to wide color gamut and HDR in Compressor. No image device is capable of capturing and reproducing the full spectrum of colors...
Read more >
Understanding the Color Gamut of an LCD Monitor - Eizo
Color gamut is one spec used to measure the image quality of an LCD monitor, but color gamut alone does not determine image...
Read more >
Enhance graphics with wide color content | Android Developers
In wide color gamut mode, a window can render outside of the sRGB gamut to display more vibrant colors. If the device does...
Read more >
How do wide gamut color images look on a regular display?
The reason the sRGB images look different than the wider profile images is ... Regular gamut monitors are not sRGB monitors - they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found