(self, data)
| 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: |
nothing calls this directly
no test coverage detected