/** * {@inheritdoc} */ public function merge() { foreach ($this->layers as $offset => $image) { try { $this->resource->setimageindex($offset); $this->resource->setimage($image->getGmagick()); } catch (\GmagickException $e) { throw new RuntimeException('Failed to substitute layer', $e->getCode(), $e); } } }