      if metadata and extension.lower() != ".png":
          raise ValueError("Metadata is only supported for .png images")
      retval = cv2.imencode(extension, image)[1]
      if metadata:
          retval = np.frombuffer(png_write_meta(retval.tobytes(), metadata), dtype="uint8")
      return retval
  
  
  def png_write_meta(png, data):
      """ Write Faceswap information to a png's iTXt field.
 
</s> remove         if os.path.isdir(self.location):
 </s> add         if not isinstance(self.location, str) or os.path.isdir(self.location): </s> remove     def _skip_num(self) -> int:
        """ int: Number of frames to skip if extract_every_n has been provided """
        return self._args.extract_every_n if hasattr(self._args, "extract_every_n") else 1
 </s> add     def embeddings(self) -> np.ndarray:
        """ :class:`numpy.ndarray`: The filter embeddings"""
        if self._embeddings and all(np.any(e) for e in self._embeddings):
            retval = np.concatenate(self._embeddings, axis=0)
        else:
            retval = np.array([])
        return retval </s> remove     def _set_skip_list(self) -> None:
        """ Add the skip list to the image loader
 </s> add     @property
    def n_embeddings(self) -> np.ndarray:
        """ :class:`numpy.ndarray`: The n-filter embeddings"""
        if self._nembeddings and all(np.any(e) for e in self._nembeddings):
            retval = np.concatenate(self._nembeddings, axis=0)
        else:
            retval = np.array([])
        return retval </s> remove     def process(self):
 </s> add     def process(self) -> None:
        retval = png_write_meta(retval.tobytes(), metadata)
      if metadata and extension.lower() != ".png":
          raise ValueError("Metadata is only supported for .png images")
      retval = cv2.imencode(extension, image)[1]
      if metadata:
        retval = png_write_meta(retval.tobytes(), metadata)
      return retval
  
  
  def png_write_meta(png, data):
      """ Write Faceswap information to a png's iTXt field.
keep keep keep keep replace keep keep keep keep keep
 Update Face Filter
  - Remove old face filter
  - plugins.extract.pipeline: Expose plugins directly
  - Change `is_aligned` from plugin level to ExtractMedia level
  - Allow extract pipeline to take faceswap aligned images
  - Add ability for recognition plugins to accept aligned faces as input
  - Add face filter to recognition plugin
  - Move extractor pipeline IO ops to own class 
lib/image.py