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."

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 :

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