0

this is my first post in stackoverflow.

So I have these custom .acv files from photoshop, what I want to do is I am trying to filter a bitmap using colormatrix. To do that, I am parsing those .acv files to get its rgb values to be used by the colormatrix. How can I do this?

Edited: Here is the colormatrix code that I want to supply with the RGB values from the .acv file. The only thing left is how to extract those values.

private Bitmap filterBitmap(Bitmap bitmap) {
    Bitmap bitmapResult = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);

    Canvas canvasResult = new Canvas(bitmapResult);
    Paint paint = new Paint();

    // R' = a*R + b*G + c*B + d*A + e;
    // G' = f*R + g*G + h*B + i*A + j;
    // B' = k*R + l*G + m*B + n*A + o;
    // A' = p*R + q*G + r*B + s*A + t;
    float m = 255f;
    float t = -255 * 128f;
    ColorMatrix colorMatrix = new ColorMatrix(new float[]{
            m, 0, 0, 1,
            0, m, 0, 1,
            0, 0, m, 1,
    });
    ColorMatrixColorFilter filter = new ColorMatrixColorFilter(colorMatrix);
    paint.setColorFilter(filter);
    canvasResult.drawBitmap(bitmap, 0, 0, paint);

    return bitmapResult;
}
lombee
  • 33
  • 4

1 Answers1

0

I'm doing this by applying curve to full palette image and then extracting rgb values from resulting image. Here's source image:

enter image description here

But I've done so because I'm it in OpenGL fragment shaders. That's why it has low resolution and not very accurate results (but very ok).

Fedor Kazakov
  • 601
  • 3
  • 12
  • Hi, thanks for idea, I am thinking that it can be my alternate solution to my problem. – lombee Jan 20 '15 at 14:00
  • I'm not sure if it can help you because it's on glsl `vec3 colorsCorrection(vec3 base) { highp vec2 lookup; base.r = base.r * 0.9 + 0.05; lookup.y = base.g; lookup.x = (base.r + floor(base.b * 15.0 + 0.50)) / 16.0; base.rgb = texture2D(supTex1, lookup).rgb; return base; }` – Fedor Kazakov Jan 20 '15 at 14:34
  • hi, sorry i could not upvote your answer. I will do so by the time I have enough reputation. – lombee Jan 21 '15 at 11:01