Improve docs related to reading from bytes
See original GitHub issueI’m trying to save bytes as frames of an animation of a plot but
import matplotlib.pyplot as plt
import imageio
plt.plot(1, 1)
fig = plt.gcf()
fig.canvas.draw()
data = fig.canvas.tostring_rgb() # These are bytes
imageio.imread(data)
File "<string>", line unknown
SyntaxError: cannot handle 76-bit layers
I also tried converting it to a numpy array of uint8s but imread
just spits the data back into my terminal and doesn’t do anything. Is this the way to read in raw bytes? Is something missing from the docs?
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
BinaryReader.ReadBytes(Int32) Method (System.IO)
Reads the specified number of bytes from the current stream into a byte array and advances the current position by that number of...
Read more >Using readable byte streams - Web APIs | MDN
Readable byte streams are readable streams that have an underlying byte source of type: "bytes" , and which support efficient zero-copy ...
Read more >Introduction to optimizing query performance | BigQuery
Optimization improves query speed and reduces cost. ... The query plan shows execution statistics such as bytes read and slot time consumed.
Read more >Multilingual Language Processing From Bytes
rectly on unicode bytes rather than language- ... results similar to or better than the state-of- ... LSTM models are reading bytes, it...
Read more >Encoding | Protocol Buffers - Google Developers
First you drop the MSB from each byte, as this is just there to tell us whether we've reached the end of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah okay, well I’ve figured it out! Just had to reshape the data a little bit before giving it to
imageio
. Here’s a little snippet that saves an animation:Ah I see. I was confused by the
imageio.imread(data)
. Glad you got it working. Nice animation!