Solved by user_123454321 in post #4 
              
              
                I think you have a palletted image with an alpha image but you are converting to RGB .convert('RGB') (first line inside getitem), and it suggests you to convert to RGBA (A for the alpha channel) to not lose information.