The images I load with Picasso seem to use a density value of DENSITY_NONE. What do I have to change to make Picasso call .setDensity(160) on the loaded images before they are displayed?
            Asked
            
        
        
            Active
            
        
            Viewed 335 times
        
    1 Answers
1
            Basing myself on another Picasso solution to resize images I implemented a custom transformation object which sets the density of images to a constant of my own:
Transformation changeDensity = new Transformation()
{
    @Override public Bitmap transform(Bitmap source)
    {
        source.setDensity(160);
        return source;
    }
    @Override public String key()
    {
        return "density";
    }
};
// …later…
Picasso
    .with(context)
    .load(imageUri)
    .transform(changeDensity)
    .into(imageView);
 
    
    
        Community
        
- 1
- 1
 
    
    
        Grzegorz Adam Hankiewicz
        
- 7,349
- 1
- 36
- 78