WriteBlob Failed `/tmp/5f49ac095abe6.png’ @ error/png.c/MagickPNGErrorHandler/1630

  imagick, php, symfony

I’m developing a php7.1 app on a windows 10 pc running symfony dev server but everytime i run a script to convert a svg to png i receive this error.

WriteBlob Failed `/tmp/5f49ac095abe6.png’ @ error/png.c/MagickPNGErrorHandler/1630

I just bought this computer and the script works on my old windows laptops. I did research and suspect this is a permissions issue but I exhausted all means to change php and imagick tmp storage location.

If it is indeed a permissions issue then how can i update where php/imagick saves tmp files.

here is my entire method for reference:

private function createImageFromSVG(ConfigLogo $logoConfig)
    $svg = $logoConfig->getDefaultImage()->getContent();
    $idColorArray = [
        'first' => $logoConfig->getFirstColor(),
        'second' => $logoConfig->getSecondColor(),
        'third' => $logoConfig->getThirdColor(),

    foreach ($idColorArray as $state => $color) {
        if ($color != 'FFFFFF') {
            $svg = preg_replace(
                '/class="' . $state . '" style="fill:#([0-9a-fA-F]{6})/',
                'class="' . $state . '" style="fill:#' . $color,

    $fileName = sprintf('%s.png', uniqid());
    $filePath = sprintf('/tmp/%s', $fileName);
    $this->filePath = $filePath;

    $im = new Imagick();
    $im->setBackgroundColor(new ImagickPixel('transparent'));

    $file = new UploadedFile($filePath, $fileName .'.png');

    $oldImages  = $logoConfig->getRenderedLogoImages();
    foreach ($oldImages as $image) {
        if ($image->getImageName() !== 'default_logo.png') {
            $this->uploadHandler->remove($image, 'imageFile');

    $renderedImage = new ConfigLogoDefaultImage();
    $this->operateImage($logoConfig, 'RenderedLogo');

The error occurs at line $im->writeImage($filePath);

Thanks in advance for any help with this.

Source: Symfony Questions