The built-in function ImageConvolve takes a Padding option that "specifies what padding to use when extending beyond the original data specified." It has several useful settings, such as:

  • $\mathit{val}$: pad with a constant value $\mathit{val}$
  • "Fixed": repetitions of the elements on each boundary
  • "Periodic": cyclic repetitions of the complete array
  • "Reflected": reflections of the array in the boundary
  • "Reversed": reversals of the complete array

In principle, ListConvolve does exactly the same thing as ImageConvolve, just on a (possibly multidimensional) list rather than an image. But surprisingly, it does not accept Padding as an option. You can only provide an extra $\mathit{padlist}$ argument with which you can replicate the $\mathit{val}$ and "Periodic" settings above. Is there a straightforward way to replicate the effect of the other settings ("Fixed", "Reflected", "Reversed") in ListConvolve?

Using ImageConvolve sandwiched between Image and ImageData calls is not an option, because one might be working with symbolic or multidimensional data.

  • 1
    $\begingroup$ "surprisingly, it does not accept Padding as an option." -probably for new-ish users, I think; ListConvolve[]/ListCorrelate[] were introduced way before ArrayPad[]. If you'll compare those two with Partition[], you'll see a number of similarities. $\endgroup$ Oct 22, 2015 at 10:21

1 Answer 1


You can just apply ArrayPad before performing the convolution; it supports all the desired padding forms and more. However, you'll have to adjust the third parameter of ListConvolve to get rid of the extra entries in the result.

  • $\begingroup$ Can you elaborate? What would I do with the third parameter? $\endgroup$
    – masterxilo
    Dec 20, 2020 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.