I want to create an Android app where I can take a picture from the SD card or from the camera. After taking the picture, I have to edit it, like adding text in the picture, cropping the picture, add .gif type file to the picture. Taking a picture isn't the problem, but I can't understand how to write code to edit the picture. I need to know whether I have to use OpenGL for this. Suggestions and helpful links wanted.
You can select a photo, image file to edit from your computer or from Google Drive. Supports multiple files open. You can enhance your photos, apply effects, crop image, rotate, flip, and so much more. It's a simple, powerful and easy to use image processing app.
import android.graphics.Bitmap; public class ProcessingImage { private Bitmap defaultImg; private int idBitmap; public int getIdBitmap() { return idBitmap; } public void setIdBitmap(int idBitmap) { this.idBitmap = idBitmap; } public Bitmap getDefaultImg() { return defaultImg; } public void setDefaultImg(Bitmap defaultImg) { this.defaultImg = defaultImg; } public ProcessingImage() { } public Bitmap processingI(Bitmap myBitmap) { return myBitmap; } public Bitmap TintThePicture(int deg, Bitmap defaultBitmap) { int w = defaultBitmap.getWidth(); int h = defaultBitmap.getHeight(); int[] pix = new int[w * h]; defaultBitmap.getPixels(pix, 0, w, 0, 0, w, h); double angle = (3.14159d * (double) deg) / 180.0d; int S = (int) (256.0d * Math.sin(angle)); int C = (int) (256.0d * Math.cos(angle)); int r, g, b, index; int RY, BY, RYY, GYY, BYY, R, G, B, Y; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { index = y * w + x; r = (pix[index] >> 16) & 0xff; g = (pix[index] >> 8) & 0xff; b = pix[index] & 0xff; RY = (70 * r - 59 * g - 11 * b) / 100; BY = (-30 * r - 59 * g + 89 * b) / 100; Y = (30 * r + 59 * g + 11 * b) / 100; RYY = (S * BY + C * RY) / 256; BYY = (C * BY - S * RY) / 256; GYY = (-51 * RYY - 19 * BYY) / 100; R = Y + RYY; R = (R < 0) ? 0 : ((R > 255) ? 255 : R); G = Y + GYY; G = (G < 0) ? 0 : ((G > 255) ? 255 : G); B = Y + BYY; B = (B < 0) ? 0 : ((B > 255) ? 255 : B); pix[index] = 0xff000000 | (R << 16) | (G << 8) | B; } } Bitmap bm = Bitmap.createBitmap(w, h, defaultBitmap.getConfig()); bm.setPixels(pix, 0, w, 0, 0, w, h); pix = null; return bm; } }
Usage: Process Indigo color: TintThePicture(180, myBitmap);
Process Green color: TintThePicture(300, myBitmap);
Use android.media.effect is provided in API14
Effect Pro
Android-Image-Edit
android-image-editor
smartcrop-android (This library will analyze best crop position and size by calculating some features; edge, skin tone, staturation and face.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With