Understanding the error in my code

JPG does not support transparency, thus if you want to save an image with alpha ie RGBA , it would need to be saved as png (or other format which support alpha transparency).

JPG, PNG RGB/RGBA and converting

3 Likes