How to configure to always use the BMP3 image format?

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?".
Post Reply
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

How to configure to always use the BMP3 image format?

Post by konstantin »

I would like to use the BMP3 image format for .bmp files, becaue I am using Arch linux and "feh" picture viewer which doesn't support BMP4 image format. I read this topic: viewtopic.php?f=1&t=23875
Which partially solve the problem:

Code: Select all

mogrify -format bmp -define bmp:format=bmp3 test*.png
But I don't want to use always the switch -define, instead of I would like to set this option in some configuration file, if possible.
Which config file should I use and how to achieve this?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to configure to always use the BMP3 image format?

Post by snibgo »

As far as I know, there is no config file to do that.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to configure to always use the BMP3 image format?

Post by fmw42 »

What version of IM are you using and platform? That define

Code: Select all

mogrify -format bmp -define bmp:format=bmp3 test*.png
is only available in IM 6.8.6.9 or later. If you are on a current version and that fails, then perhaps it "got lost" in some newer release or is a bug?

How do you know that you are not getting BMP3? Did you test with convert rather than mogrify on one image to see if that is importable in your other software?

Neither IM verbose information nor exiftool seem to indicate whether it is BMP3 or BMP4 when I do

Code: Select all

convert rose: BMP3:rose.bmp
So I do not know how to check so I can find out if it works in convert but not in mogrify.

Anyone know how to check the type of BMP?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to configure to always use the BMP3 image format?

Post by fmw42 »

Here is perhaps an alternate way from http://www.imagemagick.org/Usage/formats/#bmp:

" However, if a PNG input file was used and it contains a gAMA and cHRM chunk
(gamma and chromaticity information) either of which forces "convert" to
write a BMP4. To get a BMP3 you need to get rid of that information. One way
may be to pipeline the image though a minimal 'image data only' image file
format like PPM and then re-save as BMP3. Messy, but it should work."

convert image.png ppm:- | convert - BMP3:image.bmp
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to configure to always use the BMP3 image format?

Post by snibgo »

I think konstantin is saying that "-define bmp:format=bmp3" works, but he doesn't want to keep typing it. He wants this to be the default (for BMP outputs).
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to configure to always use the BMP3 image format?

Post by fmw42 »

snibgo wrote:I think konstantin is saying that "-define bmp:format=bmp3" works, but he doesn't want to keep typing it. He wants this to be the default (for BMP outputs).
Thanks for the correction. But I do not think IM will go backwards for its default.

I do not think there is any config parameter now, but perhaps it can be done in the delegates.xml file. I really do not know. One of the IM developers would need to answer this question.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: How to configure to always use the BMP3 image format?

Post by glennrp »

You could write a little script and put it in your $PATH, e.g.,

Code: Select all

#!/bin/sh
# tobmp3 [files]
mogrify -format bmp -define bmp:format=bmp3 $*
Then just run "tobmp3 *.png"
konstantin
Posts: 50
Joined: 2013-08-07T13:50:31-07:00
Authentication code: 6789

Re: How to configure to always use the BMP3 image format?

Post by konstantin »

snibgo wrote:I think konstantin is saying that "-define bmp:format=bmp3" works, but he doesn't want to keep typing it. He wants this to be the default (for BMP outputs).
Yes.
Post Reply