32 bit bmp access violation reading with glTexImage2D

I have a 32 bit bmp genereated with Code Heads Bitmap Font Generator that I got a copy through learnopengl’s website. I have enabled blending with glEnable(GL_BLEND). I have some corresponding python:

def loadTexture(self,filename):
    self.texture = glGenTextures(1)
    glBindTexture(GL_TEXTURE_2D, self.texture) 
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)	
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
    img = LOAD_IMAGE(filename)
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.tobytes())
    glGenerateMipmap(GL_TEXTURE_2D)
    img.close()

it is using python pillow to load the image so far. The code is working for other bmp’s the trouble with accecss violation reading starts when I load the 32 bit bmp with filename ‘ExportedFont.bmp’. Is there a way to get glTexImage2D to process the 32 bit bmp?

Check the properties of the image. Specifically, that:

len(img.tobytes()) == img.width * img.height * 4

Ohh… gosh that was very helpful. I found out that what I really wanted was the Targa32 which does have a way to do a transparent background just like I need. Thanks a bunch! One can load a tga file RGBA it works for me from the font exporter. So I guess I was wrong about that about the bmp file which is still coming out RGB only.