So, I use this library https://github.com/thuytrinh/android-collage-views to add the MultiTouchListener function to my ImageView. Basically, I allow the user to modify the photo according to his needs through rotation, scaling and translation. Now the only problem is how to save it. I did it like this:
Bitmap bitmap = Bitmap.createBitmap(imageContainer.getWidth(), imageContainer.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawColor(Color.WHITE);
imageContainer.draw(canvas);
It works, but the image is not big enough - it is as big as on the phone, so it depends on the screen resolution. And I want to "apply" these transformations to a given full-size bitmap. And I want the converted image to look like on the screen (so that it needs to crop everything from the screen)
I tried the following:
Bitmap newBitmap = Bitmap.createBitmap(image.getWidth(), image.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(newBitmap);
canvas.drawColor(Color.WHITE);
Paint paint = new Paint();
paint.setAntiAlias(true);
canvas.drawBitmap(image, imageView.getMatrix(), paint);
But this does not look as expected.
User Screen:

And output the image (without cropping, because I don't want which side I have to crop):

How can i fix this? Is there any solution?
source
share