Search code examples
linuxshellcommand-lineimagemagicktrim

ImageMagick V7 and Trimming Tool for Multiple Images


I am trying to trim multiple images in a folder using ImageMagick V7 on Linux CentOS 7 via this command-line:

magick mogrify -trim +repage -path /projectnb/burbsp/home/ialalawi/research/idl/Auroral_Image_Plots/Gill/Clear_No_Aurora/2011-01-14-01 *.png

And I get this error:

mogrify: unable to open image '.png': No such file or directory @ error/blob.c/OpenBlob/2695. mogrify: unable to open file `.png' @ error/png.c/ReadPNGImage/3983.

I just followed the format given on the ImageMagick webpage. So what am I doing wrong?


Solution

  • Your command works fine for me on IM 7.0.8.60 Q16 Mac OSX.

    This is what I did to test it.

    I created two new directories on my desktop, test1 and test2.
    
    Then I did 
    
    cd desktop/test1
    
    magick rose: -bordercolor white -border 50 rose1.png
    magick rose: -bordercolor white -border 50 rose2.png
    magick rose: -bordercolor white -border 50 rose3.png
    
    Then I used your command to successfully process the image in test1 and put the output in test2
    
    magick mogrify -trim +repage -path ../test2 *.png
    


    My best guess is that your install does not include libpng. What do you get from magick -version? Other possibilities are that you have not changed directory to the directory holding the input images or your -path directory is not correct for where you want your output images to go.

    You might also try adding -format png to your command line.

    Try repeating my command, if your IM 7 version shows PNG listed under delegates. Be sure to change directories to where your input images resize and check the spelling of your path to where you want the output images.

    Refer to here for details on mogrify.