Skip to content

Access violation after importing colour (from colour-science) #661

@roelandschoukens

Description

@roelandschoukens

test:

import numpy as np
from wand.resource import genesis as wand_genesis
from wand.image import Image

# as a workaround, call wand_genesis() before importing other packages
# this also runs successfully if we don't import colour at all.
#wand_genesis() 

import colour  # from https://github.com/colour-science/colour

with Image.from_array(np.linspace(0, 1, 256*256).reshape([256, 256])) as img:
    img.save(filename=f'test.exr')
    print("saved")

This will raise an exception from the save() call.

    r = library.MagickWriteImage(self.wand, filename)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: exception: access violation reading 0x0000000000000000

This problem started happening after I upgraded ImageMagick:

$ magick -version
Version: ImageMagick 7.1.1-38 Q16-HDRI x64 b0ab922:20240901 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Channel-masks(64-bit) Cipher DPC HDRI Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg jxl lcms lqr lzma openexr pangocairo png ps raqm raw rsvg tiff webp xml zip zlib
Compiler: Visual Studio 2022 (194134120)

and

$ py -m wand.version --verbose
Wand 0.6.13
ImageMagick 7.1.1-38 Q16-HDRI x64 b0ab922:20240901 https://imagemagick.org

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions