Keep image names but add suffix
Keep image names but add suffix
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?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Keep image names but add suffix
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.
returns lena_0.png lena_1.png
I am not sure how one would add letters.
It is easy to add numbers, but not letters.
Code: Select all
convert lena.png -crop 50x100% +repage lena_%d.png
I am not sure how one would add letters.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Keep image names but add suffix
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:
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Keep image names but add suffix
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
snibgo's IM pages: im.snibgo.com