src/Filter/Tesseract/ExtractText.php
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $tmpDir  = $this->tmpFs->createTemporaryDirectory();
        $tmpFile = $tmpDir.DIRECTORY_SEPARATOR.$thing->getKey();

        /** @var OcrOptions $options */
        $options = $this->defaults->merge($options);

        $pb = $this->tesseract->getProcessBuilder()
            ->language($options->getLanguage())
            ->source($sourcePath)
            ->output($tmpFile);

        $process = $pb->getProcess();

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

        return [$tmpFile];
    }
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $tmpDir  = $this->tmpFs->createTemporaryDirectory();
        $tmpFile = $tmpDir.DIRECTORY_SEPARATOR.$thing->getKey();

        /** @var OcrOptions $options */
        $options = $this->defaults->merge($options);

        $pb = $this->tesseract->getProcessBuilder()
            ->language($options->getLanguage())
            ->source($sourcePath)
            ->output($tmpFile);

        $process = $pb->getProcess();

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

        return [$tmpFile];
    }
@param ThingInterface   $thing
@param string           $sourcePath
@param OptionsInterface $options

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