cats-oss / android-gpuimage

Android filters based on OpenGL (idea from GPUImage for iOS)
8.98k stars 2.26k forks source link

GpuImage Group-filter #478

Open axarlotwala opened 4 years ago

axarlotwala commented 4 years ago

Please Give me a Solution how can i use GPUImage Filter Group in android. Because i have faced many more lots of problem for GpuImagegroup filters.please give me a complete solution or demo how to use group filter.

monxarat commented 4 years ago

@axarlotwala What your problem when using GPUImageFilterGroup?

axarlotwala commented 4 years ago

@axarlotwala What your problem when using GPUImageFilterGroup?

can you give me complete demo of how to use groupfilter with recyclerview . because i can search many more way but not find me a proper solution so please help me

monxarat commented 4 years ago

I have not so that demo. Why do you want using the filter live in the ListView?

axarlotwala commented 4 years ago

I have not so that demo. Why do you want using the filter live in the ListView?

because i have working with photo editing app i have require to use lots of filter so its best way to use list in filter so because if i am use single single on every effect describe in gpuimage its very boilerplate.will use maximum these 50 filter in app

monxarat commented 4 years ago

@axarlotwala I think you should create a thumbnail image corresponding to FilterGroup show in ListView instead use the live filter in each item of the ListView.

axarlotwala commented 4 years ago

I think you should create a thumbnail image corresponding to FilterGroup show in ListView instead use the live filter in each item of the ListView.

and how to define in list and apply also give me these problem solution ?

monxarat commented 4 years ago

@axarlotwala Corresponding with each FilterGroup you should save it to a database, before load it into ListView, create a thumbnail save to in disk, after using the Picasso or Glide load that thumbnail into ListView.

You should not be using the live filter in the ListView. Because the memory will leak and very weight.

axarlotwala commented 4 years ago

ok i will try these can you give me reference for similar libary for use many more filters

monxarat commented 4 years ago

I unknow a similar library.

You can create many different effects yourself using the GPUImageToneCurveFilter filter. First of all to use this class you need to create an effect for an image in Photoshop and then save it as a file with the .acv extension.

Using

/ / take image
AssetManager as = getAssets();
InputStream is = null;
Bitmap bitmap = null;
try {
  is = as.open("dog.jpg");
  bitmap = BitmapFactory.decodeStream(is);
  is.close();
} catch (IOException e) {
  Log.e("MainActivity", "Error");
}

// Take ACV file and create Filter
GPUImageToneCurveFilter filter = new GPUImageToneCurveFilter();
try {
  is = as.open("tone_curve.acv");
  filter.setFromCurveFileInputStream(is);
  is.close();
} catch (IOException e) {
  Log.e("MainActivity", "Error");
}

// Image processing with GPUImage
GPUImage gpuImage = new GPUImage(self);
gpuImage.setImage(bitmap);
gpuImage.setFilter(filter);
bitmap = gpuImage.getBitmapWithFilterApplied();

//show in ImageView
ImageView view = new ImageView(self);
view.setImageBitmap(bitmap);
setContentView(view);
hardapps1692 commented 4 years ago

I want to apply multiple filters to an image. For the very first time, I can apply filters using GPUImageFilterGroup. Let's assume I am adding CONTRAST and BRIGHTNESS to the filter group, then I want to update CONTRAST, then switch to BRIGHTNESS and apply BRIGHTNESS change to the same image, to which I have already applied CONTRAST.

So, how can I increase or decrease the properties separately on the same image? Currently, for me, both properties are applied to the original image, not on filtering images.

Please assist.