def METHOD_NAME(self, filename):
    self.img = Image.open(filename).transpose(Image.FLIP_TOP_BOTTOM)
    new_size = (1020, 340)
    self.img = self.img.resize(new_size)
    textureIDs = (pyglet.gl.GLuint * 1)()
    pyglet.gl.glGenTextures(1, textureIDs)
    textureID = textureIDs[0]
    # print('generating texture', textureID, 'from', filename)
    pyglet.gl.glBindTexture(pyglet.gl.GL_TEXTURE_2D, textureID)
    pyglet.gl.glTexParameterf(pyglet.gl.GL_TEXTURE_2D, pyglet.gl.GL_TEXTURE_WRAP_S, pyglet.gl.GL_REPEAT)
    pyglet.gl.glTexParameterf(pyglet.gl.GL_TEXTURE_2D, pyglet.gl.GL_TEXTURE_WRAP_T, pyglet.gl.GL_REPEAT)
    pyglet.gl.glTexParameterf(pyglet.gl.GL_TEXTURE_2D, pyglet.gl.GL_TEXTURE_MAG_FILTER, pyglet.gl.GL_NEAREST)
    pyglet.gl.glTexParameterf(pyglet.gl.GL_TEXTURE_2D, pyglet.gl.GL_TEXTURE_MIN_FILTER, pyglet.gl.GL_NEAREST)
    pyglet.gl.glTexImage2D(pyglet.gl.GL_TEXTURE_2D, 0, pyglet.gl.GL_RGB, self.img.size[0], self.img.size[1],
                           0, pyglet.gl.GL_RGB, pyglet.gl.GL_UNSIGNED_BYTE, self.img.tobytes())
    pyglet.gl.glBindTexture(pyglet.gl.GL_TEXTURE_2D, 0)
    return textureID