take picture from Android app and after I want to change color picture with button

StackOverflow https://stackoverflow.com/questions/22162272

  •  19-10-2022
  •  | 
  •  

سؤال

I´ve got an Android app that I developed, but my challenge is that once I´ve got the picture, I need to be able to change the picture effect, for example, gris to sepia effect.

لا يوجد حل صحيح

نصائح أخرى

Using this method you should be able to acheive your goal.

public static void SepiaEffect(Drawable drawable) {


if (drawable == null)

return;



final ColorMatrix matrixA = new ColorMatrix();
  // making image B&W
  matrixA.setSaturation(0);

  final ColorMatrix matrixB = new ColorMatrix();
  // applying scales for RGB color values
  matrixB.setScale(1f, .95f, .82f, 1.0f);
  matrixA.setConcat(matrixB, matrixA);

  final ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrixA);
  drawable.setColorFilter(filter);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top