MCPcopy Index your code
hub / github.com/plotly/plotly.py / write_passes

Method write_passes

_plotly_utils/png.py:679–707  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 2

writeMethod · 0.95
write_arrayMethod · 0.95

Calls 4

write_packedMethod · 0.95
rescale_rowsFunction · 0.85
pack_rowsFunction · 0.85
unpack_rowsFunction · 0.85

Tested by

no test coverage detected