Probably a couple ways to do that but have you tried the PIL instructions here?
If that doesn’t work, is it possible to share your app