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

Tagged:

Answers

  • 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(){
      fullScreen();
      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

    @koogs===

    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...

    https://processing.org/reference/colorMode_.html

  • Answer ✓

    This issue was reported by the OP here: https://github.com/processing/processing-android/issues/435

    I can reproduce the problem with default renderer in Processing Android mode. No issue if using P2D. Notice that resizing the image to screen dimensions does not help in the first case. In P2D, it might show some artifact lines but it is probable an innate effect.

    Kf

  • Thanks kfrajer for your input! Using P2D the image does not show banding anymore, or very little. Good workaround at least for my case.

Sign In or Register to comment.