Project

General

Profile

Bug #1486

cannot open picture

Added by cpg about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/24/2014
Due date:
% Done:

0%


Description

i was showing the app and went to show recent pictures of my son's graduation, then i realized the app could not open them.

i will provide one example of such a pic in private.

History

#1 Updated by ming about 7 years ago

  • Status changed from New to Feedback
  • Assignee set to cpg

Can you check it against the fix-image-loading branch? It is related to Picasso image loader. I tested it with Picasso 2.3—the same thing. My fix works for me, but it would give some RAM overhead because I basically disable resizing. So it would be helpful if you could test with more images.

#2 Updated by cpg about 7 years ago

  • Status changed from Feedback to Closed

closing. however, this was not high priority. don't forget to keep focus please.

merge to master any time.
i tested it with about 20 pictures that had issues before. seems to work ok.

#3 Updated by megabitdragon almost 7 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from cpg to ming

I still can't open large pictures on the master branch. In the log I get

08-06 20:25:11.605  28698-28698/org.amahi.anywhere W/OpenGLRenderer? Bitmap too large to be uploaded into a texture (4320x3240, max=4096x4096)

I know it is related to OpenGl but maybe we should show a scaled down version as suggested here

#4 Updated by ming almost 7 years ago

  • Status changed from Assigned to Feedback

As I mentioned above—the scaling was disabled to solve the initial issue. Can you both provide picture examples you used to see the issue?

#5 Updated by megabitdragon almost 7 years ago

Maybe we can use a transformation to avoid this issues. Something like this but the max size should be determined by the screen density and not exceed the openGL limit.

public class ResizeTransformation implements Transformation {
    @Override public Bitmap transform(Bitmap source) {
        int maxsize = 1024; //this should be device dependent
        int srcWidth = source.getWidth();
        int srcHeight = source.getHeight();
        int size = Math.max(srcWidth,srcHeight);
        double scaleFactor = (double)maxsize/(double)size;
        Bitmap result;
        if (scaleFactor<1)
        {
            result = Bitmap.createScaledBitmap(source, (int) (srcWidth*scaleFactor), (int)(srcHeight*scaleFactor), false);
        }
        else
        {
            result = Bitmap.createBitmap(source);
        }
        if (result != source) {
            source.recycle();
        }
        return result;
    }
    @Override public String key() { return "resize()"; }
}

and add


Picasso
            .with(getActivity())
            .load(getImageUri())
            .transform(new ResizeTransformation())
            .into(getImageView(), this);

to the setUpImageContent()

#6 Updated by ming almost 7 years ago

  • Assignee changed from ming to megabitdragon

Transformation you suggest is basically resizing. And not the best one actually. Can you provide an example of picture you have trouble with?

#7 Updated by megabitdragon almost 7 years ago

  • Status changed from Feedback to Assigned
  • Assignee changed from megabitdragon to ming

I didn't know there is a resize option in Picasso. If it is we should use it by any means. There is no point in showing the full image on devices with small screens. The resizing shock depend on pixel density.
I will place some images in the Dropbox folder for you to test.

#8 Updated by ming almost 7 years ago

  • Status changed from Assigned to Feedback
  • Assignee changed from ming to megabitdragon

Check the fix-image-loading branch. Resizing was initial troublemaker, should be better now.

#9 Updated by megabitdragon almost 7 years ago

  • Status changed from Feedback to Closed

Seem to be working now.The loading seems to be pretty slow but that's ok for now. Please merge and delete the branch.

Also available in: Atom