PNG to BMP3 using mogrify

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
pendel
Posts: 3
Joined: 2013-08-08T02:41:02-07:00
Authentication code: 6789

PNG to BMP3 using mogrify

Postby pendel » 2013-08-08T02:58:27-07:00

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...

pendel
Posts: 3
Joined: 2013-08-08T02:41:02-07:00
Authentication code: 6789

Re: PNG to BMP3 using mogrify

Postby pendel » 2013-08-08T03:16:08-07:00

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?

snibgo
Posts: 4111
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 8675309
Contact:

Re: PNG to BMP3 using mogrify

Postby snibgo » 2013-08-08T06:04:01-07:00

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
snibgo's IM pages: im.snibgo.com

pendel
Posts: 3
Joined: 2013-08-08T02:41:02-07:00
Authentication code: 6789

Re: PNG to BMP3 using mogrify

Postby pendel » 2013-08-08T15:56:06-07:00

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.

snibgo
Posts: 4111
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 8675309
Contact:

Re: PNG to BMP3 using mogrify

Postby snibgo » 2013-08-08T16:43:24-07:00

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
snibgo's IM pages: im.snibgo.com

User avatar
glennrp
Posts: 856
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG to BMP3 using mogrify

Postby glennrp » 2013-08-10T09:17:25-07:00

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.


Return to “Users”

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 10 guests