Possible Duplicate:
Free command line image converter
I need a command line tool for windows which can be used to convert an image from any common format to 24 bit bitmap. I'm writing some programs to do image manipulation in C, but I don't really want to write a ton of code to read images in multitudes of formats. I use bitmap format a lot for both reading and writing because it's pretty straight forward. I don't really want to convert all of the images by opening in paint and saving in the desired format.
Answer
ImageMagick can do format conversions with a tool that comes with it called convert
. You can find binaries for it here.
You'll want to run something like this on Windows:
for %%f in (*.jpg) do (
convert "%%~nf.jpg" -type truecolor "%%~nf.bmp"
)
Or in Bash:
for f in *.jpg; do convert "$f" -type truecolor "${f%.*}.bmp"; done
Convert picks the format automatically from the extension and -type truecolor
makes sure you are converting to 24-bit.
No comments:
Post a Comment