What are the advantages and disadvantages of adjusting image dimensions by subtracting one pixel in PHP thumbnail creation functions?

When creating thumbnails in PHP, adjusting image dimensions by subtracting one pixel can help prevent distortion or blurriness in the thumbnail. This slight adjustment can help maintain the aspect ratio of the original image and improve the overall quality of the thumbnail. However, it is important to note that this method may slightly reduce the size of the thumbnail, so it is important to test and adjust accordingly.

// Adjust image dimensions by subtracting one pixel in PHP thumbnail creation function
function createThumbnail($source, $destination, $thumbWidth, $thumbHeight) {
    list($width, $height) = getimagesize($source);
    
    $image = imagecreatefromjpeg($source);
    $thumb = imagecreatetruecolor($thumbWidth - 1, $thumbHeight - 1);
    
    imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumbWidth - 1, $thumbHeight - 1, $width, $height);
    
    imagejpeg($thumb, $destination, 80);
    
    imagedestroy($image);
    imagedestroy($thumb);
}