facebook/fresco

NativeJpegTranscoder does not properly support wide color gamut images

Open

Aperta il 22 apr 2020

Vedi su GitHub
 (11 commenti) (0 reazioni) (0 assegnatari)Java (17.072 star) (3750 fork)batch import
enhancementgood first issuehelp wanted

Descrizione

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

Guida contributor