Using a graphics library - GD Library or ImageMagick

Q&A's, tips, howto's
Locked
hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

Using a graphics library - GD Library or ImageMagick

Post 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
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post by TedWalther »

Is Dragonfly the newLISP equivalent of Ruby on Rails? Is your template system based on HAML/YAML?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post 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> ...
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post 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.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post 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?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post 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.
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de

hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post 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?!
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Using a graphics library - GD Library or ImageMagick

Post 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.

Locked