Is there a way to use the file name of the source file to name the new file? For instance:
convert freeport.jpg -color 127 (?).png
where (?) is the command to use the source file name, in this case freeport.
Thanks in advance.
new file name from source file name
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: new file name from source file name
try
convert freeport.jpg -set filename:original %t -colors 127 %[filename:original].png
convert freeport.jpg -set filename:original %t -colors 127 %[filename:original].png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: new file name from source file name
See... IM Examples, Saving Images, Filename Escapes.
http://www.imagemagick.org/Usage/files/#save_escapes
NOTE this also provides a way of using convert in a montage type situation. Though convert will always read in all images
into memory, where mogrify handles them one image at a time.
The "convert" alternative to "mogrify"
http://www.imagemagick.org/Usage/basics ... fy_convert
I only added that example a couple of days ago, so it is good timing!
.Just one word of warning, do not include the file suffix in the filename setting! IM will not see it and save it using the original file format, rather than a posibly different one that was set in the in the filename setting.
http://www.imagemagick.org/Usage/files/#save_escapes
NOTE this also provides a way of using convert in a montage type situation. Though convert will always read in all images
into memory, where mogrify handles them one image at a time.
The "convert" alternative to "mogrify"
http://www.imagemagick.org/Usage/basics ... fy_convert
I only added that example a couple of days ago, so it is good timing!
.Just one word of warning, do not include the file suffix in the filename setting! IM will not see it and save it using the original file format, rather than a posibly different one that was set in the in the filename setting.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: new file name from source file name
Thanks guys!