src/Filter/ImageMagick/ConvertImage.php
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $outputFile = $this->tmpFs->createTemporaryFile();

        $pb = $this->convert->getProcessBuilder();

        $options = $this->defaults->merge($options);

        if ($options->has($options::OPTION_FORMAT)) {
            $pb->format($options->getFormat());
        }
        if ($options->has($options::OPTION_QUALITY)) {
            $pb->quality($options->getQuality());
        }

        $pb->source($sourcePath)->output($outputFile);

        $process = $pb->getProcess();

        $code = $process->run();
        if ($code !== 0) {
            throw ProcessingFailedException::create(
                'Failed to convert image.',
                $code,
                $process->getOutput(),
                $process->getErrorOutput()
            );
        }

        return [$outputFile];
    }
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $outputFile = $this->tmpFs->createTemporaryFile();

        $pb = $this->convert->getProcessBuilder();

        $options = $this->defaults->merge($options);

        if ($options->has($options::OPTION_FORMAT)) {
            $pb->format($options->getFormat());
        }
        if ($options->has($options::OPTION_QUALITY)) {
            $pb->quality($options->getQuality());
        }

        $pb->source($sourcePath)->output($outputFile);

        $process = $pb->getProcess();

        $code = $process->run();
        if ($code !== 0) {
            throw ProcessingFailedException::create(
                'Failed to convert image.',
                $code,
                $process->getOutput(),
                $process->getErrorOutput()
            );
        }

        return [$outputFile];
    }
@param ThingInterface                $thing
@param string                        $sourcePath
@param OptionsInterface|ImageOptions $options

@throws \Asoc\Dadatata\Exception\ProcessingFailedException
@return array Paths to generated files