Write a PNG image to the output file. Most users are expected to find the :meth:`write` or :meth:`write_array` method more convenient. The rows should be given to this method in the order that they appear in the output file. For straightlaced images
(self, outfile, rows)
| 677 | ) |
| 678 | |
| 679 | def write_passes(self, outfile, rows): |
| 680 | """ |
| 681 | Write a PNG image to the output file. |
| 682 | |
| 683 | Most users are expected to find the :meth:`write` or |
| 684 | :meth:`write_array` method more convenient. |
| 685 | |
| 686 | The rows should be given to this method in the order that |
| 687 | they appear in the output file. |
| 688 | For straightlaced images, this is the usual top to bottom ordering. |
| 689 | For interlaced images the rows should have been interlaced before |
| 690 | passing them to this function. |
| 691 | |
| 692 | `rows` should be an iterable that yields each row |
| 693 | (each row being a sequence of values). |
| 694 | """ |
| 695 | |
| 696 | # Ensure rows are scaled (to 4-/8-/16-bit), |
| 697 | # and packed into bytes. |
| 698 | |
| 699 | if self.rescale: |
| 700 | rows = rescale_rows(rows, self.rescale) |
| 701 | |
| 702 | if self.bitdepth < 8: |
| 703 | rows = pack_rows(rows, self.bitdepth) |
| 704 | elif self.bitdepth == 16: |
| 705 | rows = unpack_rows(rows) |
| 706 | |
| 707 | return self.write_packed(outfile, rows) |
| 708 | |
| 709 | def write_packed(self, outfile, rows): |
| 710 | """ |
no test coverage detected