class_docstr: PNG chunk container (for use with save(pnginfo=))
class_docstr_tok: ["PNG","chunk","container","(","for","use","with","save","(","pnginfo=",")",")"]
docstr: Appends an iTXt chunk.
  
  :param key: latin-1 encodable text key name
  :param value: value for this key
  :param lang: language code
  :param tkey: UTF-8 version of the key name
  :param zip: compression flag
docstr_tok: ["Appends","an","iTXt","chunk",".",":","param","key",":","latin-1","encodable","text","key","name",":","param","value",":","value","for","this","key",":","param","lang",":","language","code",":","param","tkey",":","UTF-8","version","of","the","key","name",":","param","zip",":","compression","flag"]
code: def add_itxt(self, key, value, lang="", tkey="", zip=False):
      """Appends an iTXt chunk.
  
      :param key: latin-1 encodable text key name
      :param value: value for this key
      :param lang: language code
      :param tkey: UTF-8 version of the key name
      :param zip: compression flag
  
      """
  
      if not isinstance(key, bytes):
          key = key.encode("latin-1", "strict")
      if not isinstance(value, bytes):
          value = value.encode("utf-8", "strict")
      if not isinstance(lang, bytes):
          lang = lang.encode("utf-8", "strict")
      if not isinstance(tkey, bytes):
          tkey = tkey.encode("utf-8", "strict")
  
      if zip:
          self.add(
              b"iTXt",
              key
              + b"\0\x01\0"
              + lang
              + b"\0"
              + tkey
              + b"\0"
              + zlib.compress(value),
          )
      else:
          self.add(
              b"iTXt",
              key + b"\0\0\0" + lang + b"\0" + tkey + 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 3 for calling the PngInfo obj's underlying member method code with example usage: obj.add_itxt(key, value, lang, tkey, zip) without return types