diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
index 958f8d4792038a0ddc7603f32ee24200eac6a04f..2356abdae98a45949d107d27e2657bb27b2a375e 100644
--- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
+++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
@@ -161,7 +161,7 @@ class GraphicalFunctions
      *
      * @var string
      */
-    public $scalecmd = '-auto-orient -geometry';
+    public $scalecmd = '-auto-orient';
 
     /**
      * Used by v5_blur() to simulate 10 continuous steps of blurring
@@ -367,7 +367,11 @@ class GraphicalFunctions
             $offsetY = (int)(($data[1] - $data['origH']) * ($data['cropV'] + 100) / 200);
             $params .= ' -crop ' . $data['origW'] . 'x' . $data['origH'] . '+' . $offsetX . '+' . $offsetY . '! +repage';
         }
-        $command = $this->scalecmd . ' ' . $info[0] . 'x' . $info[1] . '! ' . $params . ' ';
+        // start with the default scale command
+        $command = $this->scalecmd;
+        // check if we should use -sample or -geometry
+        $command .= ' ' . (($options['sample'] ?? false) ? '-sample' : '-geometry');
+        $command .= ' ' . $info[0] . 'x' . $info[1] . '! ' . $params . ' ';
         // re-apply colorspace-setting for the resulting image so colors don't appear to dark (sRGB instead of RGB)
         $command .= ' -colorspace ' . $this->colorspace;
         $cropscale = $data['crs'] ? 'crs-V' . $data['cropV'] . 'H' . $data['cropH'] : '';
diff --git a/typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php b/typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php
index 6c38ba7099ef47c074ead4ac0c7eeb26dd9fabda..43c5dda78d958201763c5ef8d59349575978eded 100644
--- a/typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php
+++ b/typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php
@@ -209,10 +209,10 @@ class LocalCropScaleMaskHelper
     {
         $configuration = $processedFile->getProcessingConfiguration();
 
-        if ($configuration['useSample'] ?? false) {
-            $imageOperations->scalecmd = '-sample';
-        }
         $options = [];
+        if ($configuration['sample'] ?? false) {
+            $options['sample'] = true;
+        }
         if ($configuration['maxWidth'] ?? false) {
             $options['maxW'] = $configuration['maxWidth'];
         }
diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
index 38fc7c51d0cd56640a1498e07b66c08451852b20..39174dcc44925c8db53aa618ed1ad09a49c29b67 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
@@ -3711,6 +3711,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
                 $processingConfiguration['minWidth'] = (int)$this->stdWrapValue('minW', $fileArray ?? []);
                 $processingConfiguration['minHeight'] = (int)$this->stdWrapValue('minH', $fileArray ?? []);
                 $processingConfiguration['noScale'] = $this->stdWrapValue('noScale', $fileArray ?? []);
+                $processingConfiguration['sample'] = (bool)$this->stdWrapValue('sample', $fileArray);
                 $processingConfiguration['additionalParameters'] = $this->stdWrapValue('params', $fileArray ?? []);
                 $processingConfiguration['frame'] = (int)$this->stdWrapValue('frame', $fileArray ?? []);
                 if ($fileReference instanceof FileReference) {