skip to Main Content

Is there any way so i can crop many picture by single command or is there any option in gimp or photoshop.

The things i know is images width is 930 and height is 800. i want to split those image into two new image width should equal to 930/2=465 where height should remain same.

Anyone know the solution?

3

Answers


  1. I would suggest you use ImageMagick, which is available for free for Windows, Linux and OSX from here

    For example, to crop all jpegs in current directory to 256 pixels max by 256 pixels max

    mogrify -resize 256x256 *.jpg
    

    For your purposes, assuming an input file is called a.jpg, you probably need

    convert  a.jpg -crop 465x800+465+0 +repage a2.jpg
    convert  a.jpg -crop 465x800+0+0 +repage a1.jpg
    

    and a1.jpg and a2.jpg will be the two halves,

    I don’t know if you are on Windows or Linux, but you can put this in a loop easily enough to do all your images

    Untested:

    Linux…

    for f in *.jpg
    do
        newbase=$(basename "$f")
        convert "$f" -crop 465x800+465+0 +repage "${newbase}_1.jpg"
        convert "$f" -crop 465x800+0+0 +repage "${newbase}_2.jpg"
    done
    

    MS-DOS Command (my skills are rusty here)

    FOR %a in (*.jpg) DO something
    

    Back up your images before you try any commands!!!

    Login or Signup to reply.
  2. Assuming you have a folder with images (recursive), just images, no other files…
    Assuming all these images are large enough to split…
    you can use this script

    I’m using this to split 3840×1080 images into 2 1920×1080 images for dual screen desktop background images.

    #!/bin/bash
    
    files=$(find -type f)
    basedir=$(pwd)
    
    width=1920 
    height=1080
    
    for f in $files
    do
            dir=$(dirname "$f")
            cd $dir
    
            file=$(basename "$f")
            newfile=$(echo $file | cut -d. -f1)
    
            convert "$file" -crop ${width}x${height}+0+0 +repage "${newfile}_1_of_2.jpg"
            convert "$file" -crop ${width}x${height}+${width}+0 +repage "${newfile}_2_of_2.jpg"
    
            cd $basedir
    done
    
    Login or Signup to reply.
  3. You can try crop.bat (does not require external binaries):

    call crop.bat -source image.jpg -target image-left.jpg  -percentage yes -right 50 -force yes
    
    call crop.bat -source image.jpg -target image-right.jpg  -percentage yes -left 50 -force yes
    

    For mass image cropping you can check the for command.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search