There are minor changes in magento 2 to resize image, please use below code for resize the image in magento 2
For DirectoryList we can use this class

use Magento\Framework\App\Filesystem\DirectoryList;

public function __construct(

\Magento\Store\Model\StoreManagerInterface $storeManager,

\Magento\Framework\Filesystem $filesystem,

\Magento\Framework\Image\AdapterFactory $imageFactory,

) {

$this->_filesystem = $filesystem;

$this->_storeManager = $storeManager;

$this->_directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);

$this->_imageFactory = $imageFactory;

}


public function imageResize(){


$image=”image.jpg”;

$absPath = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath().$image;

$imageResized = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath('resized/').$image;


$imageResize = $this->_imageFactory->create();

$imageResize->open($absPath);

$imageResize->constrainOnly(TRUE);

$imageResize->keepTransparency(TRUE);

$imageResize->keepFrame(FALSE);

$imageResize->keepAspectRatio(true);

$imageResize->resize(200,200);


$dest = $imageResized ;

$imageResize->save($dest);


$resizedURL= $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'resized/'.$image;

}