Page 1 of 1

PNG to BMP3 using mogrify

Posted: 2013-08-08T02:58:27-07:00
by pendel
I've got a series of PNG images that I need to convert to BMP version 3. I have a windows app that won't tolerate BMP in version 4.

I've read the BMP info and I can successfully use convert to achieve the desired result, but I can't seem to find a way to do the same using mogrify. I've got hundreds of images to convert, so mogrify batch conversion would be highly desirable....

This works:

Code: Select all

convert test1.png BMP3:test.bmp
This doesn't:

Code: Select all

mogrify -format BMP3 test*.png
(It just produces files with a BMP3 suffix, like test1.BMP3).

It seems that I need to use

Code: Select all

mogrify -format bmp test*.png
but with some other switch to force BMP3 output?

Any help greatly appreciated...

Re: PNG to BMP3 using mogrify

Posted: 2013-08-08T03:16:08-07:00
by pendel
It seems the test1.BMP3 file that is produced is in a valid BMP3 format, so it's just the file extension that is invalid.

So, I can do my batch conversion, and then batch rename by doing this:

Code: Select all

mogrify -format BMP3 test*.png
mogrify -format bmp test*.BMP3
But that's going to take twice as long... Is there a way to do it with a single command/pass?

Re: PNG to BMP3 using mogrify

Posted: 2013-08-08T06:04:01-07:00
by snibgo
If I understand correctly, your second command uses mogrify just to rename the files, from *.BMP3 to *.bmp.

Your shell will have a command to do this much faster, eg in Windows:

Code: Select all

ren *.BMP3 *.bmp

Re: PNG to BMP3 using mogrify

Posted: 2013-08-08T15:56:06-07:00
by pendel
Thanks snibgo,

Yes, I was aware of the ren command, and have used it to solve my problem. I was showing the second mogrify command to emphasize the fact that the -format switch is applying the right format in each command.

There is a difference between file format and file extension... That's why the convert command lets you use BMP3:test1.bmp to define the format AND the file extension.

It seems the mogrify command lacks the ability to define the format AND the extension - or is there a switch I don't know about?

I tried:

Code: Select all

mogrify -format BMP3:bmp test*.png
but I just get an invalid 0KB file with a BMP3 extension, without any notification from IM that the format string, and resulting file, are invalid.

Re: PNG to BMP3 using mogrify

Posted: 2013-08-08T16:43:24-07:00
by snibgo
As far as I know, mogrify can't specify the file extension independently of the format. But I don't use mogrify (or BMP) much.

For mogrify options, see http://www.imagemagick.org/script/mogrify.php

Re: PNG to BMP3 using mogrify

Posted: 2013-08-10T09:17:25-07:00
by glennrp
I've patched the SVN repository with a new "-define bmp:format=bmp2|bmp3|bmp4" option, which will appear in
ImageMagick-6.8.6-9. This can be used with mogrify, where the "bmpN:" prefix is not available for controlling
the output format without also changing the filename extension.

In your case, you'd use

Code: Select all

mogrify -format bmp -define bmp:format=bmp3 test*.png
to create a bunch of test*.bmp files in BMP3 format.