Marko Mulwa
Marko Mulwa

Reputation: 31

How to display clear images

when displaying images in codename 1 form they appear blurred, where is and how can I solve the problem?

Have tried displaying them using image viewer and ImageLabel but non seems to work for me

    Image image = URLImage.createToStorage(
            EncodedImage.createFromImage(Utils.getTheme().getImage("default_avatar.png"), false), imageName,
            imageUrl);
    ImageViewer imageViewer = new ImageViewer(image);
    imageViewer.getAllStyles().setBgTransparency(0);

Upvotes: 1

Views: 39

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

When you download an image with URLImage it's scaled to to the size of default_avatar.png. That would mean you lost all the pixels of a larger size. You should use something like:

ConnectionRequest cr = new ConnectionRequest();
cr.downloadImageToStorage(imageName, img -> {
    // callback when image downloaded
});

Upvotes: 1

Related Questions