Search code examples
resizeimagemagickimagemagick-convert

Image not resizing in the command prompt


I want to resize my image 200x200px but below command not working. I have successfully installed imagemagick in my computer.

convert current_image.png -resize 200 new_image.png

I have tried above command but not working. I am getting error message Invalid Parameter - -resize

Please let me know how to fix that?

enter image description here


Solution

  • You are running the Windows built-in command called CONVERT.EXE which converts filesystems to NTFS and not the ImageMagick convert program.

    You have two options... the first is best if you plan on using ImageMagick only one or two times, the second one is best if you plan on using ImageMagick often.

    Option 1

    Use the full path to ImageMagick's convert program every time you want to process images, e.g.:

    C:\ImageMagick-6.9.2\convert image.png ...
    

    Your installation path may differ from the one I guessed above.

    Option 2

    Edit your PATH so that the directory where you installed ImageMagick is near the start of the PATH so that Windows finds that one first. So, you need to click:

    Start->Control Panel->System->Advanced->Environment Variables
    

    Then edit the PATH so it looks like:

    C:\ImageMagick-6.9-3;C:\other stuff
    

    Specifically, the directory containing ImageMagick must come before C:\Windows\System32 where the Windows file conversion tool lives.

    After you do that, you will just be able to type convert and it will run ImageMagick convert.