Copy Clipping Path (Memory Friendly)
View as MarkdownCopies clipping path using memory-friendly Pipeline API.
Code Snippet
// 2000-2997 Clipping path information
// http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
const int FirstPathId = 2000;
const int LastPathId = 2997;
using (var reader = new JpegReader("Apple.jpg"))
using (var writer = new JpegWriter("CopyClippingPathMemoryFriendly.jpg"))
{
if (reader.AdobeResources != null)
{
var adobeResources = new AdobeResourceDictionary();
for (int i = FirstPathId; i <= LastPathId; i++)
{
if (reader.AdobeResources.Contains(i))
{
adobeResources[i] = reader.AdobeResources[i];
}
}
writer.AdobeResources = adobeResources;
}
Pipeline.Run(reader + writer);
}
Input
Apple.jpg
Output
CopyClippingPathMemoryFriendly.jpg
Used APIs
- Aurigma.GraphicsMill.Codecs.AdobeResourceDictionary
- Aurigma.GraphicsMill.Codecs.ImageReader.AdobeResources
- Aurigma.GraphicsMill.Codecs.JpegReader
- Aurigma.GraphicsMill.Codecs.JpegWriter
- Aurigma.GraphicsMill.Codecs.JpegWriter.AdobeResources
- Aurigma.GraphicsMill.Codecs.MetadataDictionary.Contains(Object)