facebook/fresco

NativeJpegTranscoder does not properly support wide color gamut images

Open

#2,491 opened on Apr 22, 2020

View on GitHub
 (11 comments) (0 reactions) (0 assignees)Java (3,750 forks)batch import
enhancementgood first issuehelp wanted

Repository metrics

Stars
 (17,072 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

Contributor guide