How can GD handle color profiles to prevent color loss in images processed with PHP?

When processing images with PHP using GD, it is important to handle color profiles properly to prevent color loss. One way to do this is by ensuring that the color profile is preserved when saving the image. This can be achieved by using the `imagecreatefromstring()` function to create the image from the input file, then using the `imagejpeg()` function with the `IMAGETYPE_JPEG` and `100` quality parameters to save the image with the color profile intact.

$inputFile = 'input.jpg';
$outputFile = 'output.jpg';

// Create image from input file
$image = imagecreatefromstring(file_get_contents($inputFile));

// Save image with color profile preserved
imagejpeg($image, $outputFile, 100);

// Free up memory
imagedestroy($image);