Damir Buskulic on wrote...
| > What are you using it for? The formula looks like it is mento to be
| > centered on pixel 30,50 but the multipliers moves that point to
| > another
| > location with weird quadratic effects.
|
| Surprise... ;-) If I succeed, I'll send you the result, promise
|
I'll hold you to that ;-)
| The quotes does not seem to be a problem. Launched from php, the
| following command works
| $commtest = '~/util/bin/convert -size 195x152 xc: -fx \'sqrt((-9200+
| (i-30)*55+(j-50)*90)*(-9200+(i-30)*55+(j-50)*90)+12000*((i-30)*80+
| (j-50)*10))/6000\' test_p_linx.png';
|
| and generates a file of roughly 12 kB, while the following :
|
| $commtest = '~/util/bin/convert -size 200x200 xc: -fx \'sqrt((-9200+
| (i-30)*55+(j-50)*90)*(-9200+(i-30)*55+(j-50)*90)+12000*((i-30)*80+
| (j-50)*10))/6000\' test_p_linx.png';
|
| doesn't generate anything. See the difference ? Just the size of the
| generated image. Again, both work from an ssh session. I don't see
| why this would make any difference.
|
Hmmm. Same formula so it isn't parsing. First though was a division by
zero but you don't have a variable divider. You do have a sqrt
however...
Could you be generating a negative element in the sqrt().
A negative square root produces a 'complex number' with an immaginary
or "sqrt(-1)" component, which IM can not deal with.
This is a typical problem with quadratic functions, which can have
immaginary solutions.
Add a debug() statment at the start of the -fx formula and see what
pixel the function breaks down. If it does break. IM should output an
error and do nothing, but that may not be happening.
Alturnativally you can remove the 'image size' from the formula by
adjusting and scaling the pixel coordinates into a 0 to 1 range by
replacing i with i/w and j with j/h
(or better still i/(w-1) and j/(h-1))
That way the result is scaled to the image. You can even make it easier
by using some variable assignments...
-fx 'xx=i/w-.25; yy=j/h-.5; sqrt(.....)'
Using assigments will also remove the repeated segments, simplify the
formula, make debugging easier, and speed up the calculations.
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
"[A computer is] like an Old Testament god,
with a lot of rules and no mercy." --- Joseph Campbell
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users