What potential pitfalls should be considered when trying to extract specific metadata fields, such as keywords, from images using PHP?

When extracting specific metadata fields, such as keywords, from images using PHP, potential pitfalls to consider include ensuring that the images have the necessary metadata embedded, handling different image formats, and dealing with errors that may arise during the extraction process.

// Check if the image file exists
if (file_exists('image.jpg')) {
    // Get the metadata of the image
    $exif = exif_read_data('image.jpg', 'IFD0');
    
    // Check if the keywords metadata field exists
    if (isset($exif['Keywords'])) {
        $keywords = $exif['Keywords'];
        echo "Keywords: " . $keywords;
    } else {
        echo "Keywords metadata not found.";
    }
} else {
    echo "Image file not found.";
}