I tried converting a URLImage to an EncodedImage to scale it but it turned the background black. Conversion works fine, the problem only occurs when I scale the image. In the guides it says that there are size restrictions to URLImages but I do not understand how to scale it properly. If somebody could write an example on how to scale URLImages to an arbitrary size I would greatly appreciate it.
Here is the code I used
//create the form
Form hi = new Form ("urlimage scaling");
try
{
//create placeholder image
EncodedImage placeholder = EncodedImage.create("/dog.jpg").scaledEncoded(492, 290);
//get image from the web
URLImage urlimg = URLImage.createToStorage(placeholder, "https://australianbananas.com.au/Images/Home/RipenessBlend.png",
"https://australianbananas.com.au/Images/Home/RipenessBlend.png");
//try to convert and scale
EncodedImage scaledImage = EncodedImage.createFromImage(urlimg,false).scaledEncoded(Display.getInstance().getDisplayWidth(), -1);
//display image using a label
Label lbl = new Label();
lbl.setIcon(scaledImage);
hi.add(lbl);
}
catch(Exception e) {System.out.println(""+e);}
hi.show();