android-gpuimage-plus icon indicating copy to clipboard operation
android-gpuimage-plus copied to clipboard

Is it possible to get filter file from storage?

Open jinkalzalavadiya opened this issue 4 years ago • 2 comments

I want to apply filter file from android external storage. In the demo can access only from assets directory of app.

for Ex; @adjust lut file:///storage/emulated/0/backgrounds/filter/Analog/1.webp

it will gives me error.

Please help me to resolve the issues.

Thank you.

jinkalzalavadiya avatar Apr 09 '21 07:04 jinkalzalavadiya

The loading function is set by yourself. See this: https://github.com/wysaid/android-gpuimage-plus/blob/master/cgeDemo/src/main/java/org/wysaid/cgeDemo/MainActivity.java#L144

Just implement the interface CGENativeLibrary.LoadImageCallback, and call CGENativeLibrary.setLoadImageCallback

wysaid avatar Apr 10 '21 15:04 wysaid

Yes i can load bitmap from android external storage. but after bitmap how to apply filter?

There is not option to pass bitmap into config. it only pass string with original bitmap.

I want to pass 2 bitmap with configuration of filter. ex:

I call this functiona get filter image like

getBitmapWithFilter("@adjust lut filter.png");

but can't with external storage file. file:///storage/emulated/0/backgrounds/filter/Analog/1.webp

public static Bitmap getBitmapWithFilter(Bitmap bitmap, String str) { SharedContext create = SharedContext.create(); create.makeCurrent(); CGEImageHandler cGEImageHandler = new CGEImageHandler(); //below bitmap is original bitmap cGEImageHandler.initWithBitmap(bitmap); //is config string cGEImageHandler.setFilterWithConfig(str); cGEImageHandler.setFilterIntensity(0.8f); cGEImageHandler.processFilters(); Bitmap resultBitmap = cGEImageHandler.getResultBitmap(); create.release(); return resultBitmap; }

Now i have loaded bitmap from external storage but where to pass this bitmap?

jinkalzalavadiya avatar Apr 12 '21 04:04 jinkalzalavadiya