Heavy image compression / banding

edited January 30 in Android Mode

Hello, I am trying to load images in my app but once displayed they turn out to look very heavily compressed, making them not usable for what I am doing. Is there a way to turn off this automatic compression?

This is what happens when I try to display a smooth black and white gradient : This is a screenshot of what was originally a smooth gradient



  • Any idea what might be causing this? It seems to be the normal behaviour for processing on android (doesn't happen when running in java mode). I am a little surprised that no one seems to have encountered this before. The code is as simple as could be.

    PImage img;
    void setup(){
      img = loadImage("myimage.jpg");
    void draw(){
      image(img, 0, 0);
  • can you upload the src image?

    i think it might just be a problem with the limited colours available on a phone screen compared to a monitor.

    try a png if you don't want compression.

  • edited January 30

    Thanks for you answer.

    It is not a screen problem as the image displays fine when opened from a file explorer.

    Using a png gives the same result, a lot of very ugly banding once displayed.

    This is the picture I have in my data folder :

    Edit : I also tried loading external date (from url) and result is the same, so I am guessing the problem comes from loadImage() or image()

  • @hmns===

    with P5 && your image i get the same result than you on 2 phones and & 1 tablet changing the res to 240 and using Android studio (without P5, only an imageView) result is perfect but it remains the same (bands) with P5... i have to investigate!

  • what happens if you fill the screen algorithmically rather than loading an image? (using pixels array)

  • edited January 31


    yes, that could be a workaround, and i ll try it; as for now what i can see is that the problem is present even in the original: try to enlarge (in the post or using photoshop) the image posted and you ll see these bands; that is probably the reason why using native android + AS and resampling to 240, then adding params to xml (centerCrop, match_parent and so on) it works...

  • Thank you for looking into this. I tried feeling an image with a gradient algorithmically but couldn't find a way to... This would not really fix the problem anyways.

    I am not familiar with Android studio, hence why I was using processing which makes it easy to make an app and take advantage of all the libraries. Maybe there is a way to use a regular Java solution to display the image inside of the processing app?

  • I tried feeling an image with a gradient algorithmically but couldn't find a way to...


Sign In or Register to comment.