imagick icon indicating copy to clipboard operation
imagick copied to clipboard

Imagick exception NonconformingDrawingPrimitiveDefinition `6' @ error/draw.c/RenderMVGContent/4466

Open AshleyLlamas opened this issue 2 years ago • 7 comments

I'm using laravel and bacon qr code

PHP: PHP Version 7.4.20

System: Windows NT DESKTOP-PSF7LUO 10.0 build 22581 (Windows 10) AMD64 Build Date: Jun 1 2021 20:24:46 Compiler: Visual C++ 2017 Architecture: x64

IMAGICK: imagick module version: 3.7.0 imagick classes: Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel Imagick compiled with ImageMagick version: ImageMagick 7.1.0-18 Q16 x64 2021-12-14 https://imagemagick.org Imagick using ImageMagick library version: ImageMagick 7.1.0-18 Q16 x64 2021-12-14 https://imagemagick.org ImageMagick copyright: (C) 1999-2021 ImageMagick Studio LLC ImageMagick release date: 2021-12-14 ImageMagick number of supported formats: 263

RELEVANT CODE: Location: vedor>bacon>bacon-qr-code>src>Render>Image>ImagickImageBackEnd>ImagickImageBackEnd

Example of the error generator in front:

Error (Back): public function done() : string { if (null === $this->draw) { throw new RuntimeException('No image has been started'); }

    $this->image->drawImage($this->draw); //Problem  <------------------------------
    $blob = $this->image->getImageBlob();
    $this->draw->clear();
    $this->image->clear();
    $this->draw = null;
    $this->image = null;
    $this->gradientCount = null;

    return $blob;
}

`

AshleyLlamas avatar Apr 02 '22 11:04 AshleyLlamas

Short version, this message seems to appear when ImageMagick can't find either the Arial or Helvetica system fonts....which is kind of weird on Windows.

How did you install ImageMagick please?

You can probably work around it by explicitly setting a font, or making sure that fonts are available. See also: https://github.com/Imagick/imagick/issues/543

Danack avatar Apr 02 '22 15:04 Danack

Hi @Danack, I'm encountering the same problem and the #543 did not help. On the system, there are many fonts installed including Helvetic (but there is no Arial font). I have 3 configurations:

Centos + PHP 8.0.19 + Imagick 3.5.1 + LiteSpeed on which I get the above error Centos + PHP 7.4.29 + Imagick 3.5.1 + LiteSpeed on which I get the above error Ubuntu + PHP 7.4.3 + Imagick 3.4.4 + Nginx/fpm on which it works

Can you please advise how to debug this further?

CristianNi avatar May 24 '22 04:05 CristianNi

@CristianNi how are you installing Imagick? and ImageMagick also?

Danack avatar May 24 '22 10:05 Danack

@CristianNi how are you installing Imagick? and ImageMagick also?

ImageMagick 7.1.0-20 Q16-HDRI x86_64 2022-01-22 https://imagemagick.org sry for the missing info

CristianNi avatar May 24 '22 10:05 CristianNi

Yeah - but how? From source? From a repo?

Danack avatar May 24 '22 10:05 Danack

Yeah - but how? From source? From a repo?

Sorry for the late reply. We are using CloudLinux images for our vms and we installed those from cloudlinux repository. Being controlled and restricted, I am unable to build it or use other repositories.

CristianNi avatar Jun 02 '22 03:06 CristianNi

@CristianNi You'll probably need to contact CloudLinux support.

Short version - ImageMagick changed how they detect fonts at compile time. As a result of that, quite a few people building ImageMagick are finding that it's not finding any fonts. I guess that's whats happened here.

For the record, I think the fundamental problem is that using system fonts, rather than shipping the fonts you want as part of your app is probably a mistake. However ImageMagick support for app fonts is a little annoying - as you have to handle fonts explicitly rather than ImageMagick being able to find e.g. the italic font when you select Arial and then enable italics.

When you open the ticket, maybe link a link to contact me in the issue here, as I can guide them what is going on. Though a for profit company needing support from a OpenSource project without also sponsoring it is........irritating.

In the meantime, perhaps you can just explitly set the font? https://phpimagick.com/ImagickDraw/setFont

Danack avatar Jun 08 '22 19:06 Danack