We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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 :
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.
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.
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)
@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?
https://processing.org/reference/colorMode_.html
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.