I have image data in the form of a byte array, and after converting it to floats and plugging it into bpy.data.images.pixels it imports nicely into blender. Unfortunately it uses the DirectX format, where the first pixel in the array is at the top left, when Blender uses OpenGL where the first pixel in the array is at the bottom left, meaning it imports flipped on the y axis.

I would just put in the work to manually convert it but I noticed blender automatically flipped some textures, but not others, however now after attempting to tinker with it a bit, now no textures import the right way up.

Is there some code in blender to detect the right way up and is there a way I can force it to import the data as that?

  • $\begingroup$ Hello, I feel like the title and the body of your question ask for different things, do you want to know how you can detect if an image must be flipped, or do you want to know how to flip an image ? btw there is a builtin command to flip vertically bpy.ops.image.flip(use_flip_y=True) $\endgroup$
    – Gorgious
    Commented Jun 22 at 13:00


You must log in to answer this question.

Browse other questions tagged .