I have an image and store each pixel values in an array called pixels. I then get the first pixel value at location (0,0) and proceed to change only the RED value of the pixel to a specified integer. I then create a new array called encodedPixels which contains the changed value along with all the rest of the values from pixels array.
I create a new bitmap called encodedBitmap and set the encodedPixels onto this bitmap. I then call getPixels at (0,0), it should display the edited value with the changed red value, However it always displays zero and I cant seem to figure out why. Below is how I have created the bitmap
Bitmap encodedBitmap = Bitmap.createBitmap(imageWidth,imageHeight, Bitmap.Config.ARGB_8888);
encodedBitmap.setPixels(encodedPixels,0,imageWidth,0,0,imageWidth,imageHeight);
System.out.println("first pixel at encodedbitmap: " + encodedBitmap.getPixel(0,0));
0 comments:
Post a Comment