def _resize_and_copy_figures_if_referenced(parameters, contents, splits):
    """Modified to handle PNG to JPG conversion and reference updates."""
    image_size = collections.defaultdict(lambda: parameters['im_size'])
    image_size.update(parameters['images_allowlist'])
    pdf_resolution = collections.defaultdict(
        lambda: parameters['pdf_im_resolution']
    )
    pdf_resolution.update(parameters['images_allowlist'])
    
    # contents is the full content string for reference checking
    
    filename_changes = {}  # Track PNG -> JPG filename changes
    
    for image_file in _keep_only_referenced(
        splits['figures'], contents, strict=False
    ):
        actual_output_filename = _resize_and_copy_figure(
            filename=image_file,
            origin_folder=parameters['input_folder'],
            destination_folder=parameters['output_folder'],
            resize_image=parameters['resize_images'],
            image_size=image_size[image_file],
            compress_pdf=parameters['compress_pdf'],
            pdf_resolution=pdf_resolution[image_file],
            convert_png_to_jpg=parameters.get('convert_png_to_jpg', False),
            png_quality=parameters.get('png_quality', 50),
            png_size_threshold=parameters.get('png_size_threshold', 0.5),
            verbose=parameters.get('verbose', False)
        )
        
        # Track filename changes for reference updates
        if actual_output_filename != image_file:
            filename_changes[image_file] = actual_output_filename
    
    return filename_changes
Modified to handle PNG to JPG conversion and reference updates.
arxiv_latex_cleaner/arxiv_latex_cleaner.py