You can get swatch Image from this,
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$swatch = $objectManager->create('Magento\Swatches\Helper\Data')->getSwatchesByOptionsId([$swatchId]);
$imageName= $swatch[$optionid]['value'];
if(!empty($imageName)){
$imagePath=$objectManager->create('Magento\Swatches\Helper\Media')->getSwatchMediaUrl().$imageName;
echo $imagePath;
}
You can find Image value from eav_attribute_option_swatch
table. Where value
is Image path
and type
1
is uploaded image filer and 2
is color selected from color swatch.
Note: I am against of direct loading object with $objectManager
, for better impact you can inject it in your constructor. I have just given example how you can achieve it.
`