Page 1 of 2

any option for composition method of luminosity?

Posted: 2011-02-10T05:38:09-07:00
by linjuming
Image

convert test.psd[1] test.psd[2] -compose {what} -composite test.png

I find no "Luminosity" in the toturial:
http://www.imagemagick.org/Usage/compose/

can IM do it?

Re: any option for composition method of luminosity?

Posted: 2011-02-10T11:40:46-07:00
by fmw42
Please define functionally what you want the luminosity compose method to do?

Re: any option for composition method of luminosity?

Posted: 2011-02-10T19:21:36-07:00
by linjuming
In Ps, I want to design a gradient with two color which they are only different with brightness,pls see below:
Image
This type of gradient can be made by separating two layers which the top layer is blended with Luminosity.
I am trying to use ajax to generate the gradient which I only need to send the color value to php ,then the color and the overlay png will be composed to output a result png.

My english is poor, it is hard for me to describe a probem clearly, sorry for that.

Re: any option for composition method of luminosity?

Posted: 2011-02-10T19:46:33-07:00
by fmw42
try this as IM can create color gradients directly:

convert -size 25x256 gradient:"hsl(43%,50%,30%)-hsl(43%,50%,70%)" -rotate 90 result.png
or
convert -size 25x256 gradient:"hsb(43%,50%,30%)-hsb(43%,50%,70%)" -rotate 90 tmp2.png

not sure which colorspace results in the better gradient for you. But you can pick and vary the parameters.

Note I have converted your H from 155 to 43%=155/360 and randomly chose the Lightness/Brightness range from 30% to 70%


see
http://www.imagemagick.org/script/color.php
http://www.imagemagick.org/Usage/canvas/#gradient

Re: any option for composition method of luminosity?

Posted: 2011-02-10T20:08:10-07:00
by linjuming
your reply is what I need ,this method is more convenient and faster than composing two png files. Thank you very much!

Re: any option for composition method of luminosity?

Posted: 2011-02-11T00:00:44-07:00
by anthony
Gradient only generated a RGB color space, But with case you can generate HSL vaules in RGB colorspace, then tell IM it is really HSL.

See gradient in other colorspaces
http://www.imagemagick.org/Usage/canvas ... colorspace

I do something simular (but using separate channels) to generate a color wheel
http://www.imagemagick.org/Usage/channels/#colorwheel

Re: any option for composition method of luminosity?

Posted: 2011-02-11T14:43:27-07:00
by fmw42
By the way, here is how to do it with compositing two images that differ only in Brightness:

convert -size 25x256 xc:"hsb(43%,50%,30%)" xc:"hsb(43%,50%,70%)" gradient: -compose over -composite -rotate 90 result.png

the gradient mask controls the mixing of the two solid colors.

Re: any option for composition method of luminosity?

Posted: 2011-02-11T19:22:47-07:00
by linjuming
Image

Re: any option for composition method of luminosity?

Posted: 2011-02-11T19:47:10-07:00
by fmw42
Make sure you are using simple quotes and not curly quotes.

gradient: without any parameters creates a simple grayscale gradient from black (bottom) to white (top)

Please read http://www.imagemagick.org/Usage/canvas/#gradient

Also what version of IM are you using?

Note your black window showing your command has bad typing for the two xc: colors. You only have one xc: and the hsb(...) is not formatted as it should (see my command).

Re: any option for composition method of luminosity?

Posted: 2011-02-11T19:59:33-07:00
by linjuming
Image

here i paste my code from bat file:
convert -size 25x256 xc:'hsb(43%,50%,30%)' xc:'hsb(43%,50%,70%)' gradient: -compose over -composite -rotate 90 result.png
pause

or

convert -size 25x256 xc:"hsb(43%,50%,30%)" xc:"hsb(43%,50%,70%)" gradient: -compose over -composite -rotate 90 result.png
pause

Re: any option for composition method of luminosity?

Posted: 2011-02-11T20:38:18-07:00
by fmw42
that is not what is showing in the first line of code in the black part of your picture.

try running the command outside a bat file, just paste it into a command window and see what happens.

what version of IM are you using?

identify -version

do you have libpng installed? try your output with .gif or .jpg in place of .png

Re: any option for composition method of luminosity?

Posted: 2011-02-11T20:43:08-07:00
by linjuming
Image
Image

Re: any option for composition method of luminosity?

Posted: 2011-02-11T20:45:20-07:00
by fmw42
run this outside a bat file. run it directly by typing or pasting into a command window.

type

identify -version

to be sure of your version

Re: any option for composition method of luminosity?

Posted: 2011-02-11T20:46:34-07:00
by fmw42
Windows has a convert function. Have you renamed IM's convert to something else to be sure you are running the correct convert?

Re: any option for composition method of luminosity?

Posted: 2011-02-11T20:47:34-07:00
by fmw42
try upgrading to the current version of IM 6.6.7.6