Edit image in Flash and Using Imagemagick at backend

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?".
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Edit image in Flash and Using Imagemagick at backend

Post by snibgo »

The following seems reasonable to me:

3x3 is for 3-channels (eg RGB or CMY) without translation
4x4 is for 4-channels (eg RGBA or CMYK or CMYA) without translation
5x5 is for 5-channels (eg CMYKA) without translation

4x3 is for 3-channels (eg RGB or CMY) with translation
5x4 is for 4-channels (eg RGBA or CMYK or CMYA) with translation
6x5 is for 5-channels (eg CMYKA) with translation

Any other matrix size is invalid, and will be rejected by ImageMagick. (But larger matrices may become available, if future versions can process images with more than 5 channels.)

(If, for reasons of backwards compatability, IM can't reject other matrix sizes, it should document the default values used for missing matrix elements.)
snibgo's IM pages: im.snibgo.com
xtonic

Re: Edit image in Flash and Using Imagemagick at backend

Post by xtonic »

Fetched 6.6.1 and also do not notice result, although im running it from perl interfece, maybe its not affected by changes ?

Here example of color effect matrix:

Code: Select all

0.90 0.00 0.00 0.00 5.10 
0.00 0.90 0.00 0.00 15.30
0.00 0.00 0.90 0.00 25.50
0.00 0.00 0.00 1.00 0.00 
I converted it to IM 6x6 format:

Code: Select all

0.90 0.00 0.00 0.00 0.00 0.02
0.00 0.90 0.00 0.00 0.00 0.06
0.00 0.00 0.90 0.00 0.00 0.10
0.00 0.00 0.00 1.00 0.00 0.00
0.00 0.00 0.00 0.00 1.00 0.00
0.00 0.00 0.00 0.00 0.00 1.00
And results differ a lot, FLASH version produces completely grayscale image while IM makes colors just a little desaturated.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Edit image in Flash and Using Imagemagick at backend

Post by magick »

You may need to download 6.6.1 again since the ImageMagick beta on ftp.imagemagick.org is always 24 hours behind our development machine. See http://www.emanueleferonato.com/2009/04 ... ter-class/. We use the example Flash matrix they suggest and get the expected results (gray cats):
  • convert -debug transform cats.jpg -recolor \
    " 0.50 0.50 0.50 0.00 0.00 0.00 \
    0.50 0.50 0.50 0.00 0.00 0.00 \
    0.50 0.50 0.50 0.00 0.00 0.00 \
    0.00 0.00 0.00 1.00 0.00 0.00 \
    0.00 0.00 0.00 0.00 1.00 0.00 \
    0.00 0.00 0.00 0.00 0.00 1.00 " \
    cats.png
scriptguru

Re: Edit image in Flash and Using Imagemagick at backend

Post by scriptguru »

Guys, I have managed with this issue.
I have no time to explain all my investigations, but here is AS code to fix matrix for ImageMagick.

Code: Select all

	for(var i=4;i<arr.length;i+=5){
		arr[i-1]=arr[i]/255
		arr[i]=0
	}
	arr[arr.length-2]=1
	arr=arr.concat([0,0,0,0,1])
Before execution of this code "arr" variable should contain your matrix (array) which you use for ColorMatrixFilter.

In addition, this code normalizes biases so you can just use flash's output to use -recolor in ImageMagick.
pong

Re: Edit image in Flash and Using Imagemagick at backend

Post by pong »

Hi all!

I`ve tried everything described here above, but couldn`t get to change image brightness with -recolor command.
Hue, saturation works fine, but not brightness.... :(
I use IM 6.6.1 (just upgraded, few hours ago)
Here is great sample of how flash colorMatrixFilter works -> http://www.adobe.com/devnet/flash/artic ... ns_04.html

Could you please post here working -recolor matrix with brightness -50? or so....

[1,0,0,0,-50,
0,1,0,0,-50,
0,0,1,0,-50,
0,0,0,1,0]

Thanks a lot!
pong

Re: Edit image in Flash and Using Imagemagick at backend

Post by pong »

unbelievable, i got this
6x6 helps a lot!
scriptguru

Re: Edit image in Flash and Using Imagemagick at backend

Post by scriptguru »

pong, 5x5 could do the job too:

[1,0,0,-50,0,
0,1,0,-50,0,
0,0,1,-50,0,
0,0,0,1,0,
0,0,0,0,1]

(of course you should normalize -50)
Post Reply