                  sub_dict = cast("PNGHeaderDict", metadata["itxt"])
  
              if (self._alignments is not None and  # filter existing
                      not self._alignments.frame_exists(sub_dict["source"]["source_filename"])):
                  filter_count += 1
                  continue
  
              retval = (os.path.basename(fullpath), sub_dict)
 
</s> remove                 if self._alignments is None:  # Can't update legacy
                    raise FaceswapError(
                        f"The folder '{self.folder}' contains images that do not include Faceswap "
                        "metadata.\nAll images in the provided folder should contain faces "
                        "generated from Faceswap's extraction process.\nPlease double check the "
                        "source and try again.")

                if not log_once:
                    logger.warning("Legacy faces discovered. These faces will be updated")
                    log_once = True
                data = update_legacy_png_header(fullpath, self._alignments)
                if not data:
                    raise FaceswapError(
                        f"Some of the faces being passed in from '{self.folder}' could not be "
                        f"matched to the alignments file '{self._alignments.file}'\nPlease double "
                        "check your sources and try again.")
                sub_dict = data
 </s> add                 sub_dict = self._handle_legacy(fullpath, not log_once)
                log_once = True </s> remove         if is_legacy:  # Legacy updating
 </s> add         if self._alignments is not None and self._alignments.version < 2.1:  # Legacy updating </s> remove         is_legacy = self._alignments is not None and self._alignments.version < 2.1
 </s> add 
            if self._handle_duplicate(fullpath, sub_dict, seen):
                dupe_count += 1
                continue

                  sub_dict = cast("PNGHeaderDict", metadata["itxt"])
  
            if self._handle_duplicate(fullpath, sub_dict, seen):
                dupe_count += 1
                continue

              if (self._alignments is not None and  # filter existing
                      not self._alignments.frame_exists(sub_dict["source"]["source_filename"])):
                  filter_count += 1
                  continue
  
              retval = (os.path.basename(fullpath), sub_dict)
keep add keep keep keep keep keep keep
 bugfix: Alignments tool - remove faces:
  - Handle duplicate face images 
tools/alignments/media.py