I have below code with save configurable Image. But images are not save pragmatically showing below error
/*Add Images To The Product*/
$imagePath = "sample.png"; // path of the image
$product->addImageToMediaGallery($imagePath, array('image', 'small_image', 'thumbnail'), false, false);
$productRepository->save($product);
error
1 exception(s): Exception #0 (Magento\Framework\Exception\InputException): The image content is not valid.
Exception #0 (Magento\Framework\Exception\InputException): The image content is not valid.
0 /var/www/html/awardsideas/vendor/magento/module-catalog/Model/ProductRepository.php(590):
Magento\Catalog\Model\ProductRepository->processMediaGallery(Object(Magento\Catalog\Model\Product\Interceptor), Array)
1 /var/www/html/awardsideas/vendor/magento/framework/Interception/Interceptor.php(58):
Magento\Catalog\Model\ProductRepository->save(Object(Magento\Catalog\Model\Product\Interceptor))