I found a solution.
For single page image I found the function that load the pictures and I modified this function to load the pictures with the real size, without having to resize anything.
This is my function:
namespace namespace\Resize\Block\Catalog\Product\View;
class Gallery extends \Magento\Catalog\Block\Product\View\Gallery
{
public function getGalleryImagesJson()
{
$product = $this->getProduct();
$imagesItems = [];
foreach ($this->getGalleryImages() as $image) {
//change the path of the photo for the single product
$imagesItems[] = [
'thumb' => $this->getBaseUrl().'pub/media/catalog/product/'.$image['file'],
'img' => $this->getBaseUrl().'pub/media/catalog/product/'.$image['file'],
'full' => $this->getBaseUrl().'pub/media/catalog/product/'.$image['file'],
'caption' => $image->getLabel(),
'position' => $image->getPosition(),
'isMain' => $this->isMainImage($image),
];
}
if (empty($imagesItems)) {
$imagesItems[] = [
'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'),
'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
'caption' => '',
'position' => '0',
'isMain' => true,
];
}
return json_encode($imagesItems);
}
}
and my di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Block\Product\View\Gallery">
<plugin name="plugin_block_catalog_product_view_gallery"
type="namespace\Resize\Block\Catalog\Product\View\Gallery"
sortOrder="10"
disabled="false"/>
</type>
</config>