Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Bitmap pixelateImage(Bitmap img, int amount) {
- int imgWidth = img.getWidth();
- int imgHeight = img.getHeight();
- Bitmap editBitmap = Bitmap.createBitmap(imgWidth, imgHeight, Bitmap.Config.ARGB_8888);
- for (int x = 0; x < imgWidth; x++) {
- for (int y = 0; y < imgHeight; y++) {
- int snapx, snapy;
- snapx = (x / amount) * amount;
- snapy = (y / amount) * amount;
- editBitmap.setPixel(x, y, img.getPixel(snapx, snapy));
- }
- }
- return editBitmap;
- }
Advertisement
Add Comment
Please, Sign In to add comment