Image "Malformed UTF-8 characters, possibly incorrectly encoded."

I want to use image with Imagick blob I’m getting error message :

"Malformed UTF-8 characters, possibly incorrectly encoded."
/vendor/yiisoft/yii2/helpers/BaseJson.php

My function is in : frontend\actions;
class ImagesOpenAction

public function imageBlobImagick($image)
    {
        $Imagick = new \Imagick($image->image_origin);
        header("Content-Type: ". $image->mime_type);
        return $Imagick->getImagesBlob();
    }

in view i’m calling my function :

data-image="<?= \frontand\actions\ImagesOpenAction::imageBlobPage($image) ?>"

.
the image path :
uploads/imgl/org/20220220/fffea627523ba6ffa655ab48034f557211082823371645334897/2624842970ff411aa8db3f0c98c5d15a1588335518_org.jpg

In normal php file that is not inside Yii it’s work ; But inside Yii not working.

Since blob is just a raw binary data shouldn’t you encode it first when using in html doc? Like with base64.

So that mean I can’t use blob ?

Yes, you can, just store data safely:

storing: encode e.g. base64 → save to blob/text
loading: load from blob/text → base64_decode (or similar)

Search for the solution on the internet, there’s plenty out there e.g. php - How to convert an image to Base64 encoding - Stack Overflow