mukunda alavandi
mukunda alavandi

Reputation: 1

Applying Effects to HD Images

I am developing an app that deals with images and applying filters, borders etc to the image..(like photo editing app).

I am facing issue when applying filters or borders to HD images (as images will be of different size and resolution).

My Question is how do I apply filters without changing the size or dimension of the Image. Please help regarding this, Thanks in advance.

As I mentioned in the comment section of the Code, for smaller size images getDrawingCache is returning a value, but for the bigger size images it is returning null.

public Bitmap getBorderAppliedBitmap(PorterShapeImageView imgView , GPUImage gpuImage)
{
    Bitmap bmp = gpuImage.getBitmapWithFilterApplied();
    imgView.setImageBitmap(bmp);

    imgView.setDrawingCacheEnabled(true);
    imgView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    imgView.layout(0, 0,
            imgView.getMeasuredWidth(), imgView.getMeasuredHeight());
    imgView.buildDrawingCache(true);
    Bitmap bmap = Bitmap.createBitmap(imgView.getDrawingCache());
 <!-- getting null from the method imgView.getDraingCache() only for the bigger size Images -->
    imgView.setDrawingCacheEnabled(false);
    return bmap;
}

Upvotes: 0

Views: 69

Answers (1)

Atif Rehman
Atif Rehman

Reputation: 325

What you must be facing is limited Android resources issue for Image Processing techniques. The best advice for you would be to shift towards NDK and write image filters in JNI using OpenCV .

It is the best option for faster results in HD images. Any how there must be a boundary to the resolution to which an image can be processed because all professional apps create their own boundary parameters.

Upvotes: 1

Related Questions