How to batch split images using Image Magick

0

I want split few bmp images using imagemagick commandline on windows. For the new images, the original file name has to be suffixed with partnumber (eg _01 , _02).

I tried it in the following way, but its not working. Kindly help.

magick  convert *.bmp -crop 2x1@  -set filename:f '%t_%d.%e'  +repage  +adjoin  BMP3:'%[filename:f]'

Supplement question:

My original bmp image is of size 32MB but when I individually split the image into 2 parts using image magick. Each image is <1MB. Isn't each image supposed to be close to 16MB? Is it reducing the image quality? I don't want to reduce the image quality. How do I retain the size (on the disk)?

claws

Posted 2019-12-04T09:39:58.933

Reputation: 3 627

"How do I retain the size?". By size do you mean "horizontal x vertical" or "size on disk"? Is the renaming working? – somebadhat – 2019-12-04T13:54:45.583

Do you have to have the '? – somebadhat – 2019-12-04T14:21:36.287

@somebadhat: size on the disk. I edited and clarified my question. – claws – 2019-12-04T15:41:09.167

@somebadhat: No. Nothing of that sort is required. I don't know what's the role of '. I saw that's how its being used in examples on internet. So I copied it. – claws – 2019-12-04T15:43:08.060

Answers

0

First things first: Excluding "size on disk" does this do everything you want?

cmd:

set "options=-crop 2x1@ +repage" 
rem md crop
rem FOR %f IN (*.bmp) DO convert "%f" %options% "crop\%~nf_%d.bmp"
FOR %f IN (*.bmp) DO convert "%f" %options% "%~nf_%d.bmp"

script:

set "options=-crop 2x1@ +repage" 
rem md crop
rem FOR %%f IN (*.bmp) DO convert "%%f" %options% "crop\%%~nf_%%d.bmp" 
FOR %%f IN (*.bmp) DO convert "%%f" %options% "%%~nf_%%d.bmp"

bmp3

convert

quality

color

somebadhat

Posted 2019-12-04T09:39:58.933

Reputation: 607