Re: [Gimp-user] Math graphics

2007-12-21 Thread David Gowers
On Dec 21, 2007 4:49 PM, Brian Vanderburg II [EMAIL PROTECTED] wrote:
 Is there a plugin (or high speed script-fu) that would allow me to enter
 a math expression and from it create the pixel data also given a
 'viewport range'.

 XMin: -1
 XMax 1
 YMin -1
 Ymax: 1
 UseGraient: no
 Expr: red=sin(2*pi*x*y)/2+0.5;green=...,...

 or
 UseGradient: yes
Simple gradient application is best done using 'gradient map' filter.
Although since you're running windows, that may be slower.

 Expr: offset=sin(2*pi*x*y)

 Or something like that.  I imagine a script-fu could be done that could
 take the viewport, gradient, and expression and somehow execute the
 expression and plot the pixels, but it seems like script-fu would be
 somewhat slow.  I've created my own expression evaluation library which
 would easily provide all the math support I need, but don't know much
 about making GIMP plugins and since I'm only on Windows now I've had
 problems trying to compile glib/gtk under msys/mingw, plus it is C++
 except an older version which is C.

 Brian Vanderburg II

I recommend using PyGimp in combination with Numpy.

for example, here is some python source code for the first 'red' example

# it is assumed that x,y are 2d arrays
# like
# x =
# 012
# 012
# 012
#
# y =
# 000
# 111
# 222

red = numpy.sin((2 * pi) * x * y) / 2 +0.5
# calculate green, blue.. here
# ..
# expand the range (0..1) - (0..255) and convert to 8bit integers
# you would need to account for the possibility of an alpha channel here, too.
result = numpy.hstack ( (red * 255).astype('B'), (green *
255).astype('B'), (blue * 255).astype('B'))

# result.tostring() can now be written to a GIMP pixel region
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Math graphics

2007-12-21 Thread Sven Neumann
Hi,

On Fri, 2007-12-21 at 01:19 -0500, Brian Vanderburg II wrote:
 Is there a plugin (or high speed script-fu) that would allow me to enter 
 a math expression and from it create the pixel data also given a 
 'viewport range'.

Yes, there is gluas: http://pippin.gimp.org/plug-ins/gluas/


Sven


___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Math graphics

2007-12-21 Thread Raphaël Quinet
On Fri, 21 Dec 2007 01:19:21 -0500, Brian Vanderburg II [EMAIL PROTECTED] 
wrote:
 Is there a plugin (or high speed script-fu) that would allow me to enter 
 a math expression and from it create the pixel data also given a 
 'viewport range'.

Have a look at MathMap:

http://www.complang.tuwien.ac.at/schani/mathmap/

It can process existing images using arbitrarily complex mathematical
formulas.  It can also create new images from scratch, as you can see
on the examples page with the moire pattern or the Mandelbrot fractal.
It comes with a tutorial and an extensive reference manual.

-Raphaël
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


[Gimp-user] Math graphics

2007-12-20 Thread Brian Vanderburg II
Is there a plugin (or high speed script-fu) that would allow me to enter 
a math expression and from it create the pixel data also given a 
'viewport range'.

XMin: -1
XMax 1
YMin -1
Ymax: 1
UseGraient: no
Expr: red=sin(2*pi*x*y)/2+0.5;green=...,...

or
UseGradient: yes
Expr: offset=sin(2*pi*x*y)

Or something like that.  I imagine a script-fu could be done that could 
take the viewport, gradient, and expression and somehow execute the 
expression and plot the pixels, but it seems like script-fu would be 
somewhat slow.  I've created my own expression evaluation library which 
would easily provide all the math support I need, but don't know much 
about making GIMP plugins and since I'm only on Windows now I've had 
problems trying to compile glib/gtk under msys/mingw, plus it is C++ 
except an older version which is C.

Brian Vanderburg II

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user