-
Is there an option to save for file type BMP that will save it top down instead of bottom up using a negative height? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
You're describing this? https://learn.microsoft.com/en-gb/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader?redirectedfrom=MSDN
No, we don't have an option for that at the moment. Can I ask why you are interested in it? |
Beta Was this translation helpful? Give feedback.
-
Not familiar with that page. Was referring to BMP section 'Pixel array (bitmap data)' about the negative height and starting from the top. Same info though. I am working with an SSD1306 OLED display connected to a Raspberry PI via I2C. The adafruit-circuitpython-ssd1306 module is very slow copying out the image to a byte_array via io.BytesIO(). I am working with fast interrupts and am trying to find a faster way of updating the display. So far the .save() method is much faster and can complete in the interrupt time.. To do this though, I need to transpose by 90 degrees and set the SSD1306 display to be updated in vertical mode to get the bytes to align correctly. The one problem with this is the I2C is big endian, so the bits are flipped. If the .save() method saved the BMP top down instead of bottom up, rotating and possibly flipping would 'flip' the bits as well. Or is there some other way in PIL to flip the bits of the saved byte_array (or flip each of the 4 bytes to big endian in the byte_array) as it is saving the byte_array? |
Beta Was this translation helpful? Give feedback.
-
Correction: copying out to byte_array via io.BytesIO() is the method I am using with the PIL .save(format='BMP') method, adafruit's method is .image( image ) to put it in a byte_array buffer. |
Beta Was this translation helpful? Give feedback.
-
Working through this more, the option to save the image as BMP top-down in any transposition would still end up with low bit first requiring either bit flip within the byte or 4 byte flip, so still would not help. Thank you very much for your reply. |
Beta Was this translation helpful? Give feedback.
You're describing this? https://learn.microsoft.com/en-gb/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader?redirectedfrom=MSDN
No, we don't have an option for that at the moment. Can I ask why you are interested in it?