square / picasso

A powerful image downloading and caching library for Android
https://square.github.io/picasso/
Apache License 2.0
18.71k stars 3.97k forks source link

Images that have color profile fail to decode when using fit() #686

Closed muteor closed 8 years ago

muteor commented 10 years ago

Hi,

I am having trouble with a few images when using fit() I think this may have something to do with them having icc color profiles as that is the only difference I see from jpgs that load.

The images are:

http://fc06.deviantart.net/fs71/f/2014/267/2/6/catharsis_by_mimikascraftroom-d80cw05.jpg http://fc08.deviantart.net/fs70/f/2014/241/d/a/porec_dressed_in_blue_by_r_maric-d7x4cdp.jpg http://fc09.deviantart.net/fs70/f/2014/276/f/e/rock___by_glooh-d81fggf.jpg http://fc02.deviantart.net/fs70/f/2014/274/f/2/mig_29_by_vipmig-d819sv8.jpg

If I dont use fit on these images they are rendered into the imageview correctly, so android can display them, but maybe the bitmap factory is failing or some other part of picasso. In any case seems that we end up with a null result bitmap after resize.

Tried to include as much info as possible, I have sample project if you need it.

Thanks

Keith

Here is the log:

10-04 12:18:42.079    1393-1393/com.muteor.picassobug D/Picasso﹕ Main        created      [R1] Request{http://fc06.deviantart.net/fs71/f/2014/267/2/6/catharsis_by_mimikascraftroom-d80cw05.jpg resize(400,400)}
10-04 12:18:42.079    1393-1407/com.muteor.picassobug D/Picasso﹕ Dispatcher  enqueued     [R1]+0ms
10-04 12:18:42.079    1393-1413/com.muteor.picassobug D/Picasso﹕ Hunter      executing    [R1]+1ms
10-04 12:18:43.479    1393-1407/com.muteor.picassobug D/Picasso﹕ Dispatcher  retrying     [R1]+1400ms
10-04 12:18:43.479    1393-1415/com.muteor.picassobug D/Picasso﹕ Hunter      executing    [R1]+1400ms
10-04 12:18:43.487    1393-1415/com.muteor.picassobug D/dalvikvm﹕ GC_FOR_ALLOC freed 3542K, 51% free 3599K/7264K, paused 4ms, total 4ms
10-04 12:18:43.991    1393-1407/com.muteor.picassobug D/Picasso﹕ Dispatcher  retrying     [R1]+1911ms
10-04 12:18:43.991    1393-1416/com.muteor.picassobug D/Picasso﹕ Hunter      executing    [R1]+1912ms
10-04 12:18:44.495    1393-1407/com.muteor.picassobug D/Picasso﹕ Dispatcher  batched      [R1]+2418ms for error (will replay)
10-04 12:18:44.699    1393-1393/com.muteor.picassobug D/Picasso﹕ Main        errored      [R1]+2620ms
10-04 12:18:44.699    1393-1407/com.muteor.picassobug D/Picasso﹕ Dispatcher  delivered    [R1]+2621ms

And my call:

Picasso.with(StartActivity.this)
                        .load(tests.get(index))
                        .fit()
                        .into(image, new Callback() {
                            @Override
                            public void onSuccess() {
                                Toast.makeText(StartActivity.this, "Loaded" + tests.get(index), Toast.LENGTH_SHORT).show();
                            }

                            @Override
                            public void onError() {
                                Toast.makeText(StartActivity.this, "ERROR" + tests.get(index), Toast.LENGTH_SHORT).show();
                            }
                        });

And the request/response from server:

Accept-Ranges:   bytes
Cache-Control:   max-age=31536000
Content-Type:    image/jpeg
Date:            Sat, 04 Oct 2014 11:23:36 GMT
Expires:         Sun, 04 Oct 2015 11:23:36 GMT
Last-Modified:   Fri, 29 Aug 2014 14:10:38 GMT
Server:          ECAcc (lhr/4AB8)
X-Cache:         HIT
Content-Length:  250488

JPEG image

Format                    JPEG (ISO 10918)
Size                      400 x 600 px
Mode                      RGB
adobe                     100
adobe_transform           100
icc_profile               ...0ADBE....mntrRGB XYZ ............acspAPPL....none...........................-ADBE...............................................
                          cprt.......2desc...0...kwtpt........bkpt........rTRC........gTRC........bTRC........rXYZ........gXYZ........bXYZ........text....Copyright 1999 Adobe Systems
                          Incorporated...desc........Adobe RGB (1998)................................................................................XYZ .......Q........XYZ
                          ................curv.........3..curv.........3..curv.........3..XYZ ..........O.....XYZ ......4....,....XYZ ......&1.../....
Make                      Canon
Model                     Canon EOS 400D DIGITAL
Orientation               1
XResolution               (2400000, 10000)
YResolution               (2400000, 10000)
ResolutionUnit            2
Software                  Adobe Photoshop CS6 (Windows)
DateTime                  2014:04:15 22:53:38
Artist                    unknown
ExposureTime              (106, 1)
FNumber                   (14, 1)
ExifOffset                240
ExposureProgram           1
ISOSpeedRatings           100
ExifVersion               0221
DateTimeOriginal          2013:04:22 18:13:00
DateTimeDigitized         2013:04:22 18:13:00
ApertureValue             (761471, 100000)
MaxApertureValue          (4, 1)
MeteringMode              5
Flash                     16
FocalLength               (17, 1)
ColorSpace                65535
ExifImageWidth            400
ExifImageHeight           600
FocalPlaneXResolution     (3888000, 877)
FocalPlaneYResolution     (2592000, 582)
FocalPlaneResolutionUnit  2
CustomRendered            0
ExposureMode              1
WhiteBalance              0
SceneCaptureType          0
CameraOwnerName           unknown
BodySerialNumber          1480864441
LensSpecification         ((17, 1), (40, 1), (0, 0), (0, 0))
LensModel                 EF17-40mm f/4L USM
JakeWharton commented 10 years ago

This is a stellar bug report. Thanks for all the info. We'll have a look.

marckaraujo commented 10 years ago

same problem here

dnkoutso commented 10 years ago

@muteor the problem is MarkableInputStream in NetworkRequestHandler#MARKER.

private static final int MARKER = 65536;

If you increase this the image properly loads. This is of course our poor implementation of this that causes this problem.

For now you should fork the library and increase it to get the images to work but we will ensure we fix it properly so you don't need to fork.

muteor commented 10 years ago

Ok thanks for the help.

kbala-ami commented 9 years ago

I have same problem still. is it fixed?

JakeWharton commented 9 years ago

No. The bug is open.

dnkoutso commented 9 years ago

Known issue and will be fixed in 2.5.1.

JakeWharton commented 8 years ago

Closed by #1280.