This project has moved. For the latest updates, please go here.

Extracting Clipping Path Information from tif file

Nov 4, 2013 at 3:33 AM
Edited Nov 4, 2013 at 3:34 AM
I need to Get the Clipping Path information stored in the tif file.

I can see the information when I use the command line utility identify.exe.
under Clipping Path:
Clipping path:
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="200" height="200">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 45,58
L 80,124
L 147,147
L 45,147
"/>
</g>
</svg>

  Profiles:
    Profile-8bim: 4178 bytes
    Profile-icc: 3144 bytes
But when I try to print the same on to console using the following code mostly special characters are displayed.
ImageProfile prof= img.GetProfile("8bim");
byte[] p=prof.ToByteArray();
Console.WriteLine(Encoding.Default.GetString(p,0, p.Length));
Any way in which I can get the XML string to be printed ?
Coordinator
Nov 4, 2013 at 7:39 AM
Can you post a link to your image so I can use it for testing? Might be a good idea to add a property to MagickImage that returns this as xml.
Nov 4, 2013 at 7:55 AM
Hi Dirk,

Below is the link to the tif file that you can use for testing.
http://sdrv.ms/1gmjo3T

I'm using .net 2.0 framework and Magic.net Q16x86 net20 version 6.8.7.101

Thanks in advance.
Coordinator
Nov 4, 2013 at 10:27 AM
Edited Nov 4, 2013 at 10:33 AM
I just did a quick check in the source code from ImageMagick. Can you try the following:
img.GetAttribute("8BIM:1999,2998:#1");
If this works I could add a new property to MagickImage.
Nov 4, 2013 at 12:38 PM
Edited Nov 4, 2013 at 12:47 PM
Great ! It works. I'm able to get the XML.

Thank you very much !

Is it possible to get all the paths that are available in a image using the library?
Something like a method that returns a collection of path when we have the attribute named 8BIM:1999,2998 in the image file.
Coordinator
Nov 4, 2013 at 1:30 PM
Edited Nov 4, 2013 at 3:10 PM
Do you get another path with the following parameter: 8BIM:1999,2998:#2? I could add an IEnumerable<IXPathNavigable> method if that works.

Edit:
I will probably add an 8BIM class that will provide this functionality.
Nov 4, 2013 at 3:54 PM
Edited Nov 4, 2013 at 3:59 PM
I edited the image and added one more clipping path into it and tried to get the second path using the parameter 8BIM:1999,2998:#2

I'm getting the following two xml sections showing different paths for the parameter 8BIM:1999,2998:#1 and 8BIM:1999,2998:#2 respectively.
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="200" height="200">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 52,144
L 130,57
L 157,121
L 131,106
"/>
</g>
</svg>


<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="200" height="200">
<g>
<path style="fill:#00000000;stroke:#00000000;stroke-width:0;stroke-antialiasing:false" d="
M 45,58
L 80,124
L 147,147
L 45,147
"/>
</g>
</svg>
Edit : Added Link to image with two clipping path
The Image that I used is http://sdrv.ms/1b6VYbp
Coordinator
Nov 4, 2013 at 4:22 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.