Page 1 of 1

Problems with magickwand examples in branch 6.7

Posted: 2012-09-09T05:22:37-07:00
by qrilka
Currently I take part in building Haskell bindings for ImageMagick (mainly MagickWand).
For the starting point we took el.supremo's examples of using MagickWand (i.e. http://members.shaw.ca/el.supremo/MagickWand/ )
We do the development on Gentoo which has ImageMagick 6.7.8 as stable and we some troubles with those examples.
E.g. MagickDistortImage creates some "leaky pixel" - I get http://imgur.com/7V11F and it differs from el.supremo's result - http://members.shaw.ca/el.supremo/Magic ... fine_1.htm
MagickSetImageAlphaChannel always fails and for 'gel.c' I get http://imgur.com/xGel1 instead of http://members.shaw.ca/el.supremo/Magic ... button.htm

What is the proper way to resolve such issues?

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-09T15:57:50-07:00
by el_supremo
I'll try to have a look at this in the next day or so.

Pete

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-10T08:55:51-07:00
by el_supremo
I tried the affine example and it does indeed produce the leaky pixels. It also slightly reduces the size of the wizard and the colours are darker in all four images. I'm using IM 6.7.5 Q16. I'll try the other example when I get around to installing the latest IM.
@magick if you want to try it, the affine distort code is here: http://members.shaw.ca/el.supremo/MagickWand/affine.htm

Pete

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-10T10:32:28-07:00
by magick
Distort is Anthony's purview. Anthony can you explain the pixel leak?

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-11T22:37:12-07:00
by anthony
The leaky pixel is NOT a leak. It is Edge replaication caused by the default Virtual Pixel Setting...
http://www.imagemagick.org/Usage/distor ... rt_virtual
and more specifically
http://www.imagemagick.org/Usage/misc/#virtual-pixel

The solution use -virtual-pxel white or -alpha set -virtual-pixel transparent or something else more appropriate to what you are trying to do.


As for the Gell example. A lot has changed, and the example may need to be checked step by step to see what is happening. It is most likely caused by some colorspace fault. probably a linear gray colorspace interaction.

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-11T22:43:22-07:00
by qrilka
And what with MagickSetImageAlphaChannel failing? E.g. in http://members.shaw.ca/el.supremo/MagickWand/gel.htm
P.S. BTW, el_supremo, why don't you use something like github/bitbucket to publish complete compiling examples (i.e. with makefiles or whatever you use as its Windows equivalent)?

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-11T23:48:45-07:00
by anthony
Not certian I didn't write it. But I wrote the original CLI version it is based on
IM Examples, Advanced, Gell Effects
http://www.imagemagick.org/Usage/advanced/#gel_effects


NOTE; a flag to resize the output image (and set virtual canvas offset) can also be used, especially in the 90 degree example. in CLI that is done by using +distort rather than -distort

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-12T00:28:55-07:00
by qrilka
Anthony I have the same question to you (as to el_supremo) - are these examples you post link to available in some repository being runnable with help of e.g. makefile?
As for me It's much simpler to run git clone then make all (or some particular example name) and check the results than to start shell (or some IDE in el_supremo's case) and copy-paste commands one by one.

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-12T22:02:51-07:00
by anthony
The examples for CLI are written directly in a HTML format text file using a plain text editor.

The command line code is extracted and run using a perl script, and image results compared with the previous results to flag possible changes or bugs that may require looking into.

This ensures that the code you see in the HTML is actually the code that was used to generate the resulting image displayed.

There is no makefile for CLI examples as such.

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-12T22:10:44-07:00
by qrilka
anthony wrote:The examples for CLI are written directly in a HTML format text file using a plain text editor.

The command line code is extracted and run using a perl script, and image results compared with the previous results to flag possible changes or bugs that may require looking into.
Is this script publicly available? (looking through http://trac.imagemagick.org/browser did not give me any results)

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-12T22:21:46-07:00
by anthony
It is on the web server, but it is not linked from anything.

Look at
http://www.imagemagick.org/Usage/generate_examples
which is the heart of the extract and execute system. It basically looks for <CODE> blocks with the special (non-standard) tag "EXECUTE" in it. Look at the HTML course of a page such as
http://www.imagemagick.org/Usage/basics/

It is launched (with other scripts) from "generate" scripts in each sub-directory.
For example
http://www.imagemagick.org/Usage/basics/generate

whcih calls various preparation scripts in the top level area, such as...
http://www.imagemagick.org/Usage/generate_options
http://www.imagemagick.org/Usage/generate_clear
http://www.imagemagick.org/Usage/generate_compare

That last is the image compare program that compares a backed up old example against the new one just generated.
Its primary goal is in the example has not really changed to keep the older example, so as to avoid uploading the changes to the offical server in the US, (I used to upload though a dialup modem, though that was a long time ago).

Yes the "generate" script could have been a makefile, but it is not so much about checking file dates, as just doing the task of extracting, generating, and comparing the examples.

Commands are run using BASH, though perl is used for the more complex scripting.

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-13T00:36:36-07:00
by qrilka
Thanks a lot.

Re: Problems with magickwand examples in branch 6.7

Posted: 2012-09-22T05:05:18-07:00
by qrilka
el_supremo wrote:I'll try to have a look at this in the next day or so.
Pete, did you look into it?
BTW I have found that the shell commands you show in the source code does not correspond 100% to the examples on the IM website. And in gel example I don't understand why do you use MagickFxImage instead of normal MagickSetAlphaChannel (where "-alpha" is used as command line option) and also I stumbled upon problems with ImageMagick itself - viewtopic.php?f=3&t=21921 (i.e. I get wrong images using command line examples from ImageMagick)