code: def process_img(args, src_image_root, dst_image_root):
      # Dirty hack for multi-processing
      img_idx, img_info, anns = args
      src_img = Image.open(
          osp.join(src_image_root, img_info["file_name"])
      )
      labels = []
      for ann_idx, ann in enumerate(anns):
          attrs = ann["attributes"]
          text_label = attrs["transcription"]
  
          # Ignore illegible or non-English words
          if not attrs["legible"] or attrs["language"] != "english":
              continue
  
          x, y, w, h = ann["bbox"]
          x, y = max(0, math.floor(x)), max(0, math.floor(y))
          w, h = math.ceil(w), math.ceil(h)
          dst_img = src_img.crop((x, y, x + w, y + h))
          dst_img_name = f"img_{img_idx}_{ann_idx}.jpg"
          dst_img_path = osp.join(dst_image_root, dst_img_name)
          # Preserve JPEG quality
          dst_img.save(dst_img_path, qtables=src_img.quantization)
          labels.append(
              {
                  "file_name": dst_img_name,
                  "anno_info": [{"text": text_label}],
              }
          )
      src_img.close()
      return labels
  
file_path: mmocr/tools/dataset_converters/textrecog/openvino_converter.py
imports: import math
  import os
  import os.path
  from argparse import ArgumentParser
  from functools import partial
  import mmengine
  from PIL import Image
  from mmocr.utils import dump_ocr_data
label_desc: Use image node_id 2 for calling a global function with example usage: process_img(args, src_image_root, dst_image_root) and returns: labels