Bad image quality after resizing/scaling bitmap
I had blury images on low screen resolutions until I disabled scaling on bitmap load from resources:
Options options = new BitmapFactory.Options();
options.inScaled = false;
Bitmap source = BitmapFactory.decodeResource(a.getResources(), path, options);
Bitmap scale destroy quality
I have found a solution here and it works great.
Here is the part of the code for scaling the image:
public Bitmap getResizedBitmap(Bitmap bitmap, int newWidth, int newHeight) {
Bitmap resizedBitmap = Bitmap.createBitmap(newWidth, newHeight, Bitmap.Config.ARGB_8888);
float scaleX = newWidth / (float) bitmap.getWidth();
float scaleY = newHeight / (float) bitmap.getHeight();
float pivotX = 0;
float pivotY = 0;
Matrix scaleMatrix = new Matrix();
scaleMatrix.setScale(scaleX, scaleY, pivotX, pivotY);
Canvas canvas = new Canvas(resizedBitmap);
canvas.setMatrix(scaleMatrix);
canvas.drawBitmap(bitmap, 0, 0, new Paint(Paint.FILTER_BITMAP_FLAG));
return resizedBitmap;
}
HTML5 Image quality after scaling bitmap is bad
Unfortunately this is how Canvas renders the bitmap, and its not something that can be controlled by JavaScript. It is possible to get some results in various browsers using the `context.imageSmoothingEnabled' property, but currently it requires vendor prefixes. Check out this thread:
Canvas Image Smoothing
To do this with EaselJS, you need to get the canvas context, which is not currently available without manually accessing it:
var context = myStage.canvas.getContext("2d");
context.webkitImageSmoothingEnabled = context.mozImageSmoothingEnabled = true;
Android: Resizing Bitmaps without losing quality
Try Bitmap.createScaledBitmap.
It also has an option to filter the source.
Related Topics
Playing an Arbitrary Tone With Android
Android Camera Intent: How to Get Full Sized Photo
Push Notifications on Content Change
Android Get Free Size of Internal/External Memory
Push Notification Works Incorrectly When App Is on Background or Not Running
How to Use Asynctask Correctly in Android
Push Notifications in Android Platform
Getcolor(Int Id) Deprecated on Android 6.0 Marshmallow (API 23)
Context.Startforegroundservice() Did Not Then Call Service.Startforeground()
How to Programmatically Tell If a Bluetooth Device Is Connected
Android - Sms Broadcast Receiver
How to Save/Store Objects in Sharedpreferences on Android
How to Implement a Custom Alertdialog View
How to Add an Array or Object to Sharedpreferences on Android