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

Method _process_tRNS

_plotly_utils/png.py:1741–1760  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

1739 raise FormatError("bKGD chunk has incorrect length.")
1740
1741 def _process_tRNS(self, data):
1742 # http://www.w3.org/TR/PNG/#11tRNS
1743 self.trns = data
1744 if self.colormap:
1745 if not self.plte:
1746 warnings.warn("PLTE chunk is required before tRNS chunk.")
1747 else:
1748 if len(data) > len(self.plte) / 3:
1749 # Was warning, but promoted to Error as it
1750 # would otherwise cause pain later on.
1751 raise FormatError("tRNS chunk is too long.")
1752 else:
1753 if self.alpha:
1754 raise FormatError(
1755 "tRNS chunk is not valid with colour type %d." % self.color_type
1756 )
1757 try:
1758 self.transparent = struct.unpack("!%dH" % self.color_planes, data)
1759 except struct.error:
1760 raise FormatError("tRNS chunk has incorrect length.")
1761
1762 def _process_gAMA(self, data):
1763 try:

Callers

nothing calls this directly

Calls 2

FormatErrorClass · 0.85
unpackMethod · 0.45

Tested by

no test coverage detected