diff --git a/lib/private/Preview/HEIC.php b/lib/private/Preview/HEIC.php
index 9057596847c45dc607e2348a7ef66d65c6310bd7..151326129bc2fa82cbbe05a6e9c322e1da49b91f 100644
--- a/lib/private/Preview/HEIC.php
+++ b/lib/private/Preview/HEIC.php
@@ -29,4 +29,12 @@ class HEIC extends Bitmap {
 	public function getMimeType() {
 		return '/image\/hei(f|c)/';
 	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public function isAvailable(\OCP\Files\FileInfo $file) {
+		return in_array("HEIC", \Imagick::queryFonts("HEI*") );
+	}
+
 }
diff --git a/tests/lib/Preview/HEICTest.php b/tests/lib/Preview/HEICTest.php
index 324d0683953b515ac51abb3b048e34bd502b2359..63b9038d35dd1000ed3613e4607fd4785593549e 100644
--- a/tests/lib/Preview/HEICTest.php
+++ b/tests/lib/Preview/HEICTest.php
@@ -31,12 +31,18 @@ namespace Test\Preview;
 class HEICTest extends Provider {
 
 	public function setUp() {
-		parent::setUp();
+		if ( !in_array("HEIC", \Imagick::queryFormats("HEI*")) ) {
+			$this->markTestSkipped('ImageMagick is not HEIC aware. Skipping tests');
+		} else {
+			parent::setUp();
+
+			$fileName = 'testimage.heic';
+			$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
+			$this->width = 1680;
+			$this->height = 1050;
+			$this->provider = new \OC\Preview\HEIC;
+		}
 
-		$fileName = 'testimage.heic';
-		$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
-		$this->width = 1680;
-		$this->height = 1050;
-		$this->provider = new \OC\Preview\HEIC;
 	}
+
 }
\ No newline at end of file