Project still alive? If so I could use a nudge in the right direction!

Mar 16, 2012 at 12:34 PM

Hello all, first of all a big thank you to the creators of ImageMagickNET, it's exactly the tool I need for my project and was very pleased to find it on the imagemagick website.

I wouldn't say I'm particularly experienced in C#.NET, but what I'm trying to create is a simple winforms application that watches a directory and performs imagemagick operations on any new jpg files that appear there, and writes to another directory.

InputDir -> IM stuff happens -> OutputDir

I've got as far as just about every example of ImageMagickNET code I can find on the internets, which basically resizes the images and writes them. This is a good start, but I need a much more complex operation! (I could after all just achieve this with GDI+).

If I'm just using IM in the command line, the basic commands to achieve what I want are:

convert InputImage.jpg -fuzz 12% -fill none -draw 'matte x,y replace' -fill none OutputImage1.png
composite OutputImage1.png BackgroundImg.jpg -gravity south OutputImage2.jpg

That's a very dumbed down approximation of what I'm doing, but suffice to say that convert and composite and a number of corresponding CLI options are essential to what I want to achieve.

Here is my bit of C# code that is relevant here:

private void fileSystemWatcher1_Created_1(object sender, FileSystemEventArgs e)
        {
            ImageMagickNET.MagickNet.InitializeMagick();
            // FullPath is the new file's path.
            ImageMagickNET.Image img = new ImageMagickNET.Image(e.FullPath);
            ImageMagickNET.Geometry geo = new ImageMagickNET.Geometry("100x100>");
            
            img.Resize(geo);
            img.Write(@"C:\\path\\to\\newFile.png");
        }

What I'm struggling with is basically how to use convert and composite, and their operators!

As I said before, I'm not what you'd call experienced in C#, or any other language really outside of PHP/(X)HTML. I'm just trying to put together a simple prototype application that I can show to a more experienced developer.

Thanks

A note to the board admin: The 'insert code snippet' function isn't working on Opera (ver 11.61)

Dec 30, 2012 at 2:04 PM

Any solution about it?