class_docstr: PNG chunk container (for use with save(pnginfo=))
class_docstr_tok: ["PNG","chunk","container","(","for","use","with","save","(","pnginfo=",")",")"]
docstr: Appends a text chunk.
  
  :param key: latin-1 encodable text key name
  :param value: value for this key, text or an
     :py:class:`PIL.PngImagePlugin.iTXt` instance
  :param zip: compression flag
docstr_tok: ["Appends","a","text","chunk",".",":","param","key",":","latin-1","encodable","text","key","name",":","param","value",":","value","for","this","key",",","text","or","an",":","py",":","class",":","`","PIL.PngImagePlugin.iTXt","`","instance",":","param","zip",":","compression","flag"]
code: def add_text(self, key, value, zip=False):
      """Appends a text chunk.
  
      :param key: latin-1 encodable text key name
      :param value: value for this key, text or an
         :py:class:`PIL.PngImagePlugin.iTXt` instance
      :param zip: compression flag
  
      """
      if isinstance(value, iTXt):
          return self.add_itxt(
              key, value, value.lang, value.tkey, zip=zip
          )
  
      # The tEXt chunk stores latin-1 text
      if not isinstance(value, bytes):
          try:
              value = value.encode("latin-1", "strict")
          except UnicodeError:
              return self.add_itxt(key, value, zip=zip)
  
      if not isinstance(key, bytes):
          key = key.encode("latin-1", "strict")
  
      if zip:
          self.add(b"zTXt", key + b"\0\0" + zlib.compress(value))
      else:
          self.add(b"tEXt", key + b"\0" + value)
  
imports: import logging
  import re
  import struct
  import zlib
  from .None import Image, ImageFile, ImagePalette
  from ._binary import i8, i16be, i32be, o16be, o32be
  from ._util import py3
label_desc: Use image node_id 4 for calling the PngInfo obj's underlying member method code with example usage: obj.add_text(key, value, zip) and returns: self, self