How to fix the «failed to open stream: Invalid argument in vendor/magento/framework/Image/Adapter/Gd2.php» Magento 2.2 bug in Windows?

Replace the code:

with the following one:

$result = str_replace('/', DIRECTORY_SEPARATOR, $result);
$prefix = (substr($result, 0, 1) == DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : '';
$result = $this->join($result, $this->getModule());
$result = $this->join($result, $this->getMiscPath());
$result = $this->join($result, str_replace('/', DIRECTORY_SEPARATOR, $this->getFilePath()));

See also: