RSS/Atom feed Twitter
Site is read-only, email is disabled

Math graphics

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

Math graphics Brian Vanderburg II 21 Dec 07:19
  Math graphics David Gowers 21 Dec 09:07
  Math graphics Sven Neumann 21 Dec 09:44
  Math graphics Raphaël Quinet 21 Dec 09:50
Brian Vanderburg II
2007-12-21 07:19:21 UTC (about 17 years ago)

Math graphics

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

David Gowers
2007-12-21 09:07:37 UTC (about 17 years ago)

Math graphics

On Dec 21, 2007 4:49 PM, 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'.

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

Sven Neumann
2007-12-21 09:44:03 UTC (about 17 years ago)

Math graphics

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

Raphaël Quinet
2007-12-21 09:50:54 UTC (about 17 years ago)

Math graphics

On Fri, 21 Dec 2007 01:19:21 -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'.

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