# /usr/bin/env /opt/anaconda/bin/python import pyvips slab = pyvips.Image.new_from_array([[1]*10]*10, scale=100) # 10x10 moving average n = 30000 # also segfaults when n=30000. See note below. # The following are all fine uchar_im = pyvips.Image.black(n, n).cast('uchar') # just to be sure it's uchar uchar_im.conv(slab, precision='approximate', layers=1).write_to_file('uchar_conv.v') float_im = pyvips.Image.black(n, n).cast('float') float_im.conv(slab, precision='approximate', layers=1).write_to_file('float_conv.v') # EVERY CONVOLUTION BELOW THIS LINE SEGFAULTS ushort_im = pyvips.Image.black(n, n).cast('ushort') # if n=1, completes by writing result to file, then segfaults in python: # *** Error in `python': free(): invalid pointer: 0x00005651d79154c0 *** # if n=30000, does not complete and segfaults in libvips # [1049087.739802] worker[599]: segfault at 7f4cd631a000 ip 00007f4ce7f93318 sp 00007f4cd2caea70 error 4 in libvips.so.42.9.0[7f4ce7eb6000+1f5000] ushort_im.conv(slab.cast('ushort'), precision='approximate', layers=1).write_to_file( 'ushort_conv.v') # segfault happens here # ushort_im = pyvips.Image.black(n, n).cast('ushort') # ushort_im.conv(slab, precision='approximate', layers=1).write_to_file( 'ushort_conv.v') # segfault happens here # short_im = pyvips.Image.black(n, n).cast('short') # short_im.conv(slab, precision='approximate', layers=1).write_to_file('short_conv.v') # segfault also happens here