Page 1 of 1
Keep image names but add suffix
Posted: 2018-01-07T18:09:16-07:00
by Valkarin
I have a lot of images that I would like to split in two equal sizes, but I would like to keep the original name, but add an a to the leftmost part and a b to the right most part after the split. I know how to split the images, but don't know about naming output files this way. Currently, I just name the new files split000.png. Any ideas or at least where to look?
Re: Keep image names but add suffix
Posted: 2018-01-07T18:34:58-07:00
by fmw42
What is your IM version and platform, since syntax may differ? Please always provide that when asking questions.
It is easy to add numbers, but not letters.
Code: Select all
convert lena.png -crop 50x100% +repage lena_%d.png
returns lena_0.png lena_1.png
I am not sure how one would add letters.
Re: Keep image names but add suffix
Posted: 2018-01-07T20:42:38-07:00
by fmw42
The only way I can think to do that is
Code: Select all
convert logo.png -write mpr:img +delete \
\( mpr:img -gravity west -crop 50x100%+0+0 +repage +write logo_a.png \) \
\( mpr:img -gravity east -crop 50x100%+0+0 +repage +write logo_b.png \) \
null:
Re: Keep image names but add suffix
Posted: 2018-01-07T21:04:14-07:00
by snibgo
An alternative that uses less memory (bash syntax):
Code: Select all
convert logo: -crop 50x100% +repage \
\( -clone 0 -write logo_a.png +delete \) \
-delete 0 \
logo_b.png