I have this code:
public static String scaleImage(ImageElement imageElement, String mime_type) {
Canvas canvasTmp = Canvas.createIfSupported();
Context2d context = canvasTmp.getContext2d();
canvasTmp.setCoordinateSpaceWidth(imageElement.getWidth());
canvasTmp.setCoordinateSpaceHeight(imageElement.getHeight());
context.drawImage(imageElement, 0, 0, imageElement.getWidth(), imageElement.getHeight());
// How to set quality?
String tempStr = canvasTmp.toDataUrl(mime_type);
return tempStr;
}
The problem with this code is the output String tempStr is just data:,