This project has moved and is read-only. For the latest updates, please go here.

Extract Image Countour

Jan 15, 2014 at 6:03 PM
Hello,

I would like to ask you guys if I can use Magick.NET library to extract the clipping path of an image that was built using CorelDraw.

In my scenario the image can be exported to any file format CorelDraw supports. For me, the important this is to have a path of the external boundaries of the image, with lines and curves forming the contour path‎ of the image.

Then I would use this path inside my .NET application.

What would be the best file format for this?

Thank you,

Igor.
Jan 15, 2014 at 9:42 PM
I don't know if it is the best format but you could try using tiff images for this. With the ClipMask property you should be able to extract a mask based on your clipping path.
Jan 15, 2014 at 10:10 PM
Thank you for the reply,

Well, I created a sample code to load a sample .tif image, and I got a MagickBlobErrorException, with the following additional information:

unable to open image `C:\<mypath>\circle.tif': Invalid argument @ error/blob.c/OpenBlob/2643

I did not invoke the MagickNET.Initialize method, since I don´t have any custom configuration. Is this OK?

Here is the code:

using (MagickImage image = new MagickImage(@"C:\<mypath>\Documentos\circle.tif"))
        {

        }
Any thoughts?

Igor.
Jan 15, 2014 at 10:15 PM
Are you sure you are using the correct path to your image? And can you add a link to your file?
Jan 15, 2014 at 10:27 PM
Hello dlemstra,

If I use a wrong file path, than I get an ArgumentException with the "Unable to find file" details.

You can find the sample file here: http://sdrv.ms/1fzmr9U

I forgot to mention that I installed your libray using the Package Manager Console.

Library version: Magick.NET-Q16-x86 6.8.8.201

Thanks,

Igor.
Jan 15, 2014 at 10:47 PM
I can open the file without any problems, does your path include any special characters? ImageMagick cannot find a clipping path in your image. Are you sure you posted the correct image?
Jan 15, 2014 at 10:56 PM
Edited Jan 15, 2014 at 10:57 PM
One problem is solved. The file was in my local drive, but it was under skydrive folder (I think your library did not like it very much). So I moved it to another folder and image could be read successfully.

Regarding the clipping path, this is related to my original question. Should I include a clipping path in my original CorelDraw file? I did not do anything.

If I have to manually include a clipping path in every original file prior to exporting to TIFF, is there any other way to get the shape outline as a path (lines and curves) without adding a clipping path?

Thank you,

Igor.
Jan 16, 2014 at 6:15 AM
Edited Jan 16, 2014 at 6:15 AM
The skydrive folder problem might be a bug in ImageMagick, I will look into this.

You will have to add the clipping path yourself. ImageMagick has no support for detecting a clipping path. It used to come with a library that tries to do this but that was removed due to GPL license issues. Maybe CorelDraw has some tools to generate the path?