blur a image at android

后端 未结 1 1999
日久生厌
日久生厌 2021-01-21 07:44

i want blur a image,i used :

    public Bitmap mohu(Bitmap bmpOriginal,int hRadius,int vRadius) {
    int width, height, r,g, b, c,a, gry,c1,a1,r1,g1,b1,red,gree         


        
1条回答
  •  清歌不尽
    2021-01-21 08:25

    Your intermediate image is RGB565. That means 16 bits, 5 bits for R, 6 for G and 5 for B. If the original image is RGB888 then it would look bad after blurring. Can you not create an intermediate image in the same format as the original ?

    Also, if the original image is RGB888, how is it converted to 565 ? Your code has:

    c = bmpOriginal.getPixel(x, y);
    inPixels[i]=c;
    

    It looks like there is no controlled conversion.

    Your blur function is for an ARGB image. As well as being inefficient since you've hard coded for 565, if the original image is ARGB8888 then your conversion to RGB565 is going to do strange things with the alpha channel.

    If this answer is not enough, it would be helpful to see some "bad" images that this code creates.

    0 讨论(0)
提交回复
热议问题