Page 1 of 1

How to multiply an image by a constant ?

Posted: 2014-09-26T04:24:00-07:00
by voldemarz
Sorry if this is a simple question, but I can't find info online.

I have substracted two images and would like scale the resulting diff image by some constant to make differences more noticeable. I'd imagine ImageMagick is able to do this, but I can't find the right commands for this. Can anyone point me to the right place, documentation?

Re: How to multiply an image by a constant ?

Posted: 2014-09-26T05:09:03-07:00
by snibgo
If you want to multiply all the pixel values by a certain factor, such as 45, then "-evaluate Multiply 45". See http://imagemagick.org/script/command-l ... p#evaluate

"-auto-level" may also be useful.

Re: How to multiply an image by a constant ?

Posted: 2014-09-26T05:24:01-07:00
by voldemarz
Thanks, it works. I just achieved the same result using -color-matrix. It seems though there is something wrong with the examples here http://www.imagemagick.org/Usage/color_ ... lor-matrix

It doesn't work if colon is placed after input file name as in the example, the convert tool just keeps reading input from console (Windows 8.1).

Re: How to multiply an image by a constant ?

Posted: 2014-09-26T05:43:10-07:00
by snibgo
The usage pages show Bash commands, not Windows commands. See http://www.imagemagick.org/Usage/windows/

For example, use double-quotes for Windows:

Code: Select all

convert rose: -color-matrix "6x1: 0,0,0,0,0,1"  matrix_red_max.png
Or, I believe better, don't use spaces so you don't need quotes:

Code: Select all

convert rose: -color-matrix 6x1:0,0,0,0,0,1  matrix_red_max.png

Re: How to multiply an image by a constant ?

Posted: 2014-10-01T15:40:31-07:00
by anthony
voldemarz wrote:Thanks, it works. I just achieved the same result using -color-matrix. It seems though there is something wrong with the examples here http://www.imagemagick.org/Usage/color_ ... lor-matrix

It doesn't work if colon is placed after input file name as in the example, the convert tool just keeps reading input from console (Windows 8.1).
The colon ':' in "rose:" is part of the name of a built in image. for a file you would not have a colon unless you are specifying the image type of the file. EG: "type:filename"