any option for composition method of luminosity?

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?".
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

any option for composition method of luminosity?

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post by fmw42 »

Please define functionally what you want the luminosity compose method to do?
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: any option for composition method of luminosity?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post 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
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: any option for composition method of luminosity?

Post by linjuming »

your reply is what I need ,this method is more convenient and faster than composing two png files. Thank you very much!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: any option for composition method of luminosity?

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post 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.
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: any option for composition method of luminosity?

Post by linjuming »

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post 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).
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: any option for composition method of luminosity?

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post 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
Last edited by fmw42 on 2011-02-11T20:43:39-07:00, edited 1 time in total.
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: any option for composition method of luminosity?

Post by linjuming »

Image
Image
Last edited by linjuming on 2011-02-11T20:46:06-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: any option for composition method of luminosity?

Post by fmw42 »

try upgrading to the current version of IM 6.6.7.6
Post Reply