diff --git a/typo3/sysext/backend/Classes/Resource/Processing/DeferredBackendImageProcessor.php b/typo3/sysext/backend/Classes/Resource/Processing/DeferredBackendImageProcessor.php
index 23f1665b29dc6474a8d82b02e990ded64219aa2f..1237d52d98b63fcb6435fb7b12ed7f64c7cb37aa 100644
--- a/typo3/sysext/backend/Classes/Resource/Processing/DeferredBackendImageProcessor.php
+++ b/typo3/sysext/backend/Classes/Resource/Processing/DeferredBackendImageProcessor.php
@@ -21,6 +21,7 @@ use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Http\ApplicationType;
+use TYPO3\CMS\Core\Imaging\Exception\ZeroImageDimensionException;
 use TYPO3\CMS\Core\Imaging\ImageDimension;
 use TYPO3\CMS\Core\Resource\ProcessedFileRepository;
 use TYPO3\CMS\Core\Resource\Processing\ProcessorInterface;
@@ -48,7 +49,12 @@ class DeferredBackendImageProcessor implements ProcessorInterface
 
     public function processTask(TaskInterface $task): void
     {
-        $imageDimension = ImageDimension::fromProcessingTask($task);
+        try {
+            $imageDimension = ImageDimension::fromProcessingTask($task);
+        } catch (ZeroImageDimensionException $e) {
+            // To not fail image processing, we just assume an image dimension here
+            $imageDimension = new ImageDimension(64, 64);
+        }
         $processedFile = $task->getTargetFile();
         if (!$processedFile->isPersisted()) {
             // For now, we need to persist the processed file in the repository to be able to reference its uid
diff --git a/typo3/sysext/core/Classes/Imaging/Exception/ZeroImageDimensionException.php b/typo3/sysext/core/Classes/Imaging/Exception/ZeroImageDimensionException.php
new file mode 100644
index 0000000000000000000000000000000000000000..afc706757e659fd56c3f1813da99e15efbc86d6f
--- /dev/null
+++ b/typo3/sysext/core/Classes/Imaging/Exception/ZeroImageDimensionException.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+namespace TYPO3\CMS\Core\Imaging\Exception;
+
+use TYPO3\CMS\Core\Exception;
+
+/**
+ * This exception is thrown when an image is tasked to be processed with
+ * dimensions of zero.
+ */
+class ZeroImageDimensionException extends Exception
+{
+}
diff --git a/typo3/sysext/core/Classes/Imaging/ImageDimension.php b/typo3/sysext/core/Classes/Imaging/ImageDimension.php
index e5e62136abb5bbf1640ab70bb878e79c5580920c..abdeb25c722844f39ae6de48e1e1caa3ff00a774 100644
--- a/typo3/sysext/core/Classes/Imaging/ImageDimension.php
+++ b/typo3/sysext/core/Classes/Imaging/ImageDimension.php
@@ -17,6 +17,7 @@ declare(strict_types=1);
 
 namespace TYPO3\CMS\Core\Imaging;
 
+use TYPO3\CMS\Core\Imaging\Exception\ZeroImageDimensionException;
 use TYPO3\CMS\Core\Imaging\ImageManipulation\Area;
 use TYPO3\CMS\Core\Resource\ProcessedFile;
 use TYPO3\CMS\Core\Resource\Processing\LocalPreviewHelper;
@@ -73,7 +74,7 @@ class ImageDimension
             );
         }
         if ($imageDimension->width <= 0 || $imageDimension->height <= 0) {
-            throw new \BadMethodCallException('Width and height of the image must be greater than zero', 1597310560);
+            throw new ZeroImageDimensionException('Width and height of the image must be greater than zero.', 1597310560);
         }
         $result = GeneralUtility::makeInstance(GraphicalFunctions::class)->getImageScale(
             [
diff --git a/typo3/sysext/core/Classes/Resource/Processing/SvgImageProcessor.php b/typo3/sysext/core/Classes/Resource/Processing/SvgImageProcessor.php
index 4a58d4916909dc8e3e722d2b1bd9004bb3b7023e..6fe9d31646e905798904394c423b982ffe2b0151 100644
--- a/typo3/sysext/core/Classes/Resource/Processing/SvgImageProcessor.php
+++ b/typo3/sysext/core/Classes/Resource/Processing/SvgImageProcessor.php
@@ -17,6 +17,7 @@ declare(strict_types=1);
 
 namespace TYPO3\CMS\Core\Resource\Processing;
 
+use TYPO3\CMS\Core\Imaging\Exception\ZeroImageDimensionException;
 use TYPO3\CMS\Core\Imaging\ImageDimension;
 
 /**
@@ -44,7 +45,7 @@ class SvgImageProcessor implements ProcessorInterface
         $task->getTargetFile()->setUsesOriginalFile();
         try {
             $imageDimension = ImageDimension::fromProcessingTask($task);
-        } catch (\Throwable $e) {
+        } catch (ZeroImageDimensionException $e) {
             // To not fail image processing, we just assume an SVG image dimension here
             $imageDimension = new ImageDimension(64, 64);
         }