Page 1 of 1

Using a graphics library - GD Library or ImageMagick

Posted: Tue Jul 05, 2011 5:10 am
by hilti
Hi Guys!

I'm currently working part-time on a visual search project written in newLISP. Now it's time to scale some images.

Does anyone have experiences in accessing GDLib or ImageMagick?
A full example including picture upload, scaling and saving to disk would be great. :-)

Thanks so much!
Hilti

Re: Using a graphics library - GD Library or ImageMagick

Posted: Tue Jul 05, 2011 4:49 pm
by TedWalther
Is Dragonfly the newLISP equivalent of Ruby on Rails? Is your template system based on HAML/YAML?

Re: Using a graphics library - GD Library or ImageMagick

Posted: Tue Jul 05, 2011 6:48 pm
by hilti
Hi Ted!

Dragonfly is a web framework for newLISP, although not as "magical" as Ruby on Rails. Template markup languages like HAML aren't currently supported.

The templating system is pretty basic, e.g.

Code: Select all

<html><title><% (print "This is my title") %></title> ...

Re: Using a graphics library - GD Library or ImageMagick

Posted: Wed Jul 06, 2011 6:25 am
by TedWalther
To answer your original question, so far I've used imagemagic using (exec) to use the commandline utilities. I never got much traction with the C libraries themselves, so haven't made any newlisp modules for them. I agree, it would be very nice to have such modules.

Re: Using a graphics library - GD Library or ImageMagick

Posted: Wed Jul 06, 2011 6:28 am
by TedWalther
Instead of HAML, what if we used HNML? It is a sort of pun; instead of being pronounced "hamel", it would be "hanimal". It would execute newlisp instead of ruby code. But also, instead of python indentation, it would use sexps. Or something sexp-ish.

And I have to know; I have seen some similar concepts in dragonfly and RoR. Was dragonfly inspired a lot by Ruby on Rails, or just a little bit?

Re: Using a graphics library - GD Library or ImageMagick

Posted: Wed Jul 06, 2011 2:49 pm
by hilti
Dragonfly was inspired by different frameworks we've (Greg and I) came across in the last years.

Here's my short bio from http://www.rundragonfly.com/about ;-)
Marc Hildmann is a web developer since 1998, started writing apps in pure PHP, tried a little bit Ruby on Rails, experimented with some PHP Frameworks like Codeigniter and finally discovered newLISP. He's interested in retro-computing, especially the first XEROX machines and the good old SGI Indy.
But one last thing:
Deployment in Dragonfly is much easier than in Rails. ;-)
Rails Deployment is pain. Really pain.

Re: Using a graphics library - GD Library or ImageMagick

Posted: Wed Jul 06, 2011 2:53 pm
by hilti
TedWalther wrote:To answer your original question, so far I've used imagemagic using (exec) to use the commandline utilities.
That's the way I do it right now, too. Feels a bit unreliable to me.

How Do I start in writing C-Bindings for imagemagick - I didn't find any docs about it?!

Re: Using a graphics library - GD Library or ImageMagick

Posted: Wed Jul 06, 2011 9:19 pm
by Lutz
There is a chapter about importing C-library functions in the CodePatterns document:

http://www.newlisp.org/downloads/CodePa ... tml#toc-23

And shorter documentation in the Users Manual and Reference:

http://www.newlisp.org/downloads/newlis ... _libraries

... each of the functions in that list says something which could be important when importing C-library functions.

There are also several standard modules using C-libraries:

http://www.newlisp.org/code/modules/crypto.lsp.html

http://www.newlisp.org/code/modules/gmp.lsp.html

http://www.newlisp.org/code/modules/mysql.lsp.html

http://www.newlisp.org/code/modules/odbc.lsp.html

http://www.newlisp.org/code/modules/postgres.lsp.html

http://www.newlisp.org/code/modules/sqlite3.lsp.html

http://www.newlisp.org/code/modules/unix.lsp.html

http://www.newlisp.org/code/modules/zlib.lsp.html

... reading and understanding relevant code is always a big help.


An OpenGL example (has callbacks!)

http://www.newlisp.org/syntax.cgi?downl ... mo-lsp.txt

For ImageMagic and GD you would need the developer docs for C-programmers, to see how functions are called, what data types they take, etc.

You definitely need to know how to program in C or get somebody to help you, who knows.