Hi, I'm using ImageMagick 7.0.8-64 Q16 for Windows and MATLAB R2019. I'm doing the same operation (resizing with bicubic interpolation method) in both programs.

ImageMagick code:

magick start.png -resize 400x200! -interpolate Catrom -quality 100 start_magick_100.png


start_matlab = imresize(start, [200 400], "bicubic")
imwrite(start_matlab, "start_matlab.png", "png")

Now, the difference is not visible but reading again both images in MATLAB and ImageJ they are a little bit different in terms of pixels count. I mean that the pixel count is the same but summing the image matrix in MATLAB give me a different result. How can it be possible? Do IM and Matlab could have different functions even for these simple operations?

  • What's the relation to graphic design? How do you expect a designer to answer this? Look at the golden ratio? :)
    – Lucian
    Sep 20, 2019 at 8:20
  • Sorry for the inappropriate location. Maybe some interpolation knowledge (that I lack) could be useful, but this might not be the right place! Sep 20, 2019 at 8:24
  • 2
    Try superuser, stackoverflow, etc.
    – Lucian
    Sep 20, 2019 at 8:25
  • 1
    I'm voting to close this question as off-topic because it belongs on Super-User or Stack Overflow Sep 20, 2019 at 15:30
  • I'm not sure you can access to the source code of Matlab, so you can try to perform the same operation with Octave. If the result is identical to the one obtained with Matlab, you can read the sources of both Octave and ImageMagick and see where the algorithms differ. Feb 11, 2021 at 23:10

2 Answers 2


Different algorithms produces different result and both software handle interpolation differently.

Looking at your code gives a hint that you’re using catmull-rom algorithm for bicubic interpolation in image magic. It gives the smooth result but can’t be compared pixel to pixel with a different algorithm (matlab)


I will answer this quickly before it gets closed. The answer is simply:

Implementation details count.

So even if the math is the same. Processing might not be the same. Math and images themselves do not have a straight forward enough interpretation. Think:

  • How do you do the math in integer arithmetic
  • How do you round numbers?
  • Do you implement it all in one stage or not?
  • Do you process the image numbers in linear space?
    • or do you just do gamma correction.
    • or do you implement a cms?
    • or do you take the numbers at face value?


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.