How to use fximage in PHP?
How to use fximage in PHP?
How can I use the below line of code in PHP imagick?
convert -channel green input.jpg -fx "u*42/255" out.jpg
Please let me know. Thanks in advance.
convert -channel green input.jpg -fx "u*42/255" out.jpg
Please let me know. Thanks in advance.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to use fximage in PHP?
That code is not valid. -fx is not -channel sensitive. It should be
For Imagick, see http://us3.php.net/manual/en/imagick.fximage.php
Code: Select all
convert input.jpg -fx "u.g*42/255" out.jpg
Re: How to use fximage in PHP?
Hello Fmw42,
Thank you for your quick response. Can you please let me know how can i use imagick fximage expression for the changing the Curves values of Output = 160 and Input = 130 for any image, please see the attached screen shot for your reference and please provide the imagick fximage expression or any other function from which I can do that for the same changes.
Thanks in advanced.
Thank you for your quick response. Can you please let me know how can i use imagick fximage expression for the changing the Curves values of Output = 160 and Input = 130 for any image, please see the attached screen shot for your reference and please provide the imagick fximage expression or any other function from which I can do that for the same changes.
Thanks in advanced.
- Attachments
-
- Change Output = 160 and Input = 130
- curves.png (35.2 KiB) Viewed 26320 times
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to use fximage in PHP?
Neither Imagemagick nor Imagick have a curves function like that. -fx can be used to create a curve if you know the mathematical formula. The closest thing in Imagemagick is either -gamma or -evaluate pow or -evaluate log. Imagick should have equivalent functions.
See
http://www.imagemagick.org/Usage/transform/#fx
http://www.imagemagick.org/Usage/color_ ... evel_gamma
http://www.imagemagick.org/Usage/color_mods/#non-linear
http://www.imagemagick.org/Usage/color_mods/#curves
http://www.imagemagick.org/script/comma ... p#evaluate
Or if on Unix-like systems, you can use one of my scripts via PHP exec(). See my scripts, curves or kneemap at my link below. Kneemap shows comparison curve graphs for -evaluate pow (-gamma), -evaluate log and kneemap.
See
http://www.imagemagick.org/Usage/transform/#fx
http://www.imagemagick.org/Usage/color_ ... evel_gamma
http://www.imagemagick.org/Usage/color_mods/#non-linear
http://www.imagemagick.org/Usage/color_mods/#curves
http://www.imagemagick.org/script/comma ... p#evaluate
Or if on Unix-like systems, you can use one of my scripts via PHP exec(). See my scripts, curves or kneemap at my link below. Kneemap shows comparison curve graphs for -evaluate pow (-gamma), -evaluate log and kneemap.
Re: How to use fximage in PHP?
Thanks again for quick response.
I am using the PHP scripting language for converting the photoshop curves values as mentioned earlier. Also I didn't know the mathematical formula for changing the same with -fx but I think the fximage will works exactly same as photoshop curves, please suggest.
Also please let me know if Gamma or Evaluate Imagick function will solve my problem?
Thanks in advanced.
I am using the PHP scripting language for converting the photoshop curves values as mentioned earlier. Also I didn't know the mathematical formula for changing the same with -fx but I think the fximage will works exactly same as photoshop curves, please suggest.
Also please let me know if Gamma or Evaluate Imagick function will solve my problem?
Thanks in advanced.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to use fximage in PHP?
You can draw a polynomial function using control point using -fx, as per http://www.imagemagick.org/Usage/color_mods/#curves. But it is not the easiest way. If all you want is a slight curve such as in your diagram, you can do that with -evaluate pow X. That would be the easiest way in Imagick.
Sorry, I do not know to what extent you are doing
Sorry, I do not know to what extent you are doing
Converting them into what?I am using the PHP scripting language for converting the photoshop curves values as mentioned earlier.
Re: How to use fximage in PHP?
Hello Fred,
Thank you. I will check the Imagick -evaluate pow X to do the changes in image same as photoshop curves did.
Also I am using PHP language for using the photoshop features in website using the Imagick functions.
Thank you. I will check the Imagick -evaluate pow X to do the changes in image same as photoshop curves did.
Also I am using PHP language for using the photoshop features in website using the Imagick functions.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to use fximage in PHP?
This can be done with power curve, out = in ^ p, where...mjamal wrote:Can you please let me know how can i use imagick fximage expression for the changing the Curves values of Output = 160 and Input = 130 for any image
p = log (y) / log(x)
... where x is the required input and y is the output, both in the range 0.0 to 1.0.
In your case, y=160/255 and x=130/255, so p is 0.69180585.
Code: Select all
convert in.png -evaluate Pow 0.69180585 out.png
Sorry, I don't know IMagick.
snibgo's IM pages: im.snibgo.com
Re: How to use fximage in PHP?
Thanks snibgo,
I am trying with the "-evaluate Pow 0.69180585" in Imagick but it is not providing the exact result which we are getting from photoshop. I am using the below line of code for converting the same.
$imagick->evaluateimage(Imagick::EVALUATE_POW, 0.69180585, imagick::CHANNEL_ALL);
Still investigating for the exact result.
BTW Thanks for your valuable feedback.
I am trying with the "-evaluate Pow 0.69180585" in Imagick but it is not providing the exact result which we are getting from photoshop. I am using the below line of code for converting the same.
$imagick->evaluateimage(Imagick::EVALUATE_POW, 0.69180585, imagick::CHANNEL_ALL);
Still investigating for the exact result.
BTW Thanks for your valuable feedback.
Re: How to use fximage in PHP?
Also is there any other was I can change the photoshop CURVES output & input values from image magick functions?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to use fximage in PHP?
If you show us the input image and the two outputs, perhaps we can suggest the reason.mjamal wrote:... but it is not providing the exact result which we are getting from photoshop.
There are many ways of applying transformation curves in ImageMagick. See the links supplied by fmw42. My own pages describe various methods.mjamal wrote:Also is there any other was I can change the photoshop CURVES output & input values from image magick functions?
Photoshop is an interactive editor, so you can tweak the curve and judge the effect. My pages describe how to automatically collect information about the image, and generate the curve that has a required effect.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to use fximage in PHP?
If you have one specific set of points on the photoshop Curves. You can create a HALD CLUT image in Imagemagick. Then apply the same points to that image in Photoshop to capture the exact Photoshop curve. Then bring that result back to Imagemagick and use -hald-clut to apply it to any image. Do not save the HALD image as JPG or any lossless compressed image.
See http://www.imagemagick.org/Usage/color_mods/#hald-clut
I do not know if Imagick supports half-clut command.
You can also do the same with a gradient image and just us -clut.
See http://www.imagemagick.org/Usage/color_mods/#color_lut
See http://www.imagemagick.org/Usage/color_mods/#hald-clut
I do not know if Imagick supports half-clut command.
You can also do the same with a gradient image and just us -clut.
See http://www.imagemagick.org/Usage/color_mods/#color_lut