Question

here is sample java code which pixelates selected area on image.

pixelate sample in java

i want to achieve similar functionality in android. searched a lot but dint find any example. any help will be appreciated.

Was it helpful?

Solution

1.try to search for resize/re-sampling algorithms

  • like bilinear filtering ...

2.average color will do it too

  • make nested for loops x0,y0 through pixelated image (small resolution)
  • compute average color of the pixel area in source image (big resolution)
    • this is also done by 2 nested for loops x1,y1 through pixel area
    • just sum all R,G,B values separately
    • then divide them by number of pixels
  • store resulting color to pixelated image pixel(x0,y0)

[Notes]

if your pixelated image is the same resolution (or pixels' are area of pixels)

  • then instead of pixelated pixel fill entire pixel area by average color
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top