Skip to content

MagickWand: significant performance drop when stroking paths with scale > 1 #8443

@IKupriyanov-HORIS

Description

@IKupriyanov-HORIS

ImageMagick version

7.1.1-46

Operating system

Linux

Operating system, version and so on

Ubuntu 22.04 LTS

Description

We encountered some very strange behavior when drawing geometries.

Here is an example of what we want to draw (50_000 circles):
Image

This works satisfactorily fast (about 4 seconds) in three out of four cases. But when the circle has a stroke and the scaling in the transformation is greater than one, there is a sharp drop in performance—drawing takes 44 seconds.
Image

The situation is even worse if the circle is drawn using a path (arc with angle=2*PI). In this case, drawing 50,000 circles will not complete.

Image

Steps to Reproduce

These images are automatically generated by our library. The MVG is dumped using the DrawGetVectorGraphics function.

DrawCircle test:

  1. Unzip circle_50000.zip
  2. Run magick -size 600x400 mvg:./circle_50000.mvg circle_50000.png
    Result: conversion takes acceptable time, like ~5 seconds (could be better, though?)
  3. Unzip [email protected]
  4. Run magick -size 1200x800 mvg:./[email protected] [email protected]
    Result: conversion takes unacceptable 40+ seconds, yet the only difference is the affine 2 0 0 2 0 0 at the beginning of the file.

DrawPath* test:

  1. Unzip path_10000.zip
  2. Run magick -size 800x400 mvg:./path_10000.mvg path_10000.png
    Result: converted in zero seconds.
  3. Unzip [email protected]
  4. Run magick -size 1200x800 mvg:./[email protected] [email protected]
    Result: conversion takes unacceptable 5 seconds to draw just 10_000 circles, yet the only difference is the affine 2 0 0 2 0 0 at the beginning of the file.

Images

circle_50000.zip
[email protected]
path_10000.zip
[email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions