Ok, I'm currently using BennuGD port on Android, maybe that's the problem. If you have the opportunity plz test the same example so we can confirm the bug exists.this was my workaround to detect the end of the file: