Save the image to the named *file*. See `.write()` if you already have an open file object. In general, you can only call this method once; after it has been called the first time the PNG image is written, the source data will have been streamed, and cannot
(self, file)
| 1270 | self.info = info |
| 1271 | |
| 1272 | def save(self, file): |
| 1273 | """Save the image to the named *file*. |
| 1274 | |
| 1275 | See `.write()` if you already have an open file object. |
| 1276 | |
| 1277 | In general, you can only call this method once; |
| 1278 | after it has been called the first time the PNG image is written, |
| 1279 | the source data will have been streamed, and |
| 1280 | cannot be streamed again. |
| 1281 | """ |
| 1282 | |
| 1283 | w = Writer(**self.info) |
| 1284 | |
| 1285 | with open(file, "wb") as fd: |
| 1286 | w.write(fd, self.rows) |
| 1287 | |
| 1288 | def write(self, file): |
| 1289 | """Write the image to the open file object. |
no test coverage detected