Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active July 27, 2023 00:24

Aspose.Imaging .NET API allows allows programmatically convert your Djvu images to various image formats with high quality in your .NET application or Web service.

You can:

  • convert Djvu pages to images;
  • convert Djvu to multi page (i.e. pdf) or multi frame image formats;

Interested ?

You may go further at : https://products.aspose.com/imaging/net/

using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of ApngOptions
var exportOptions = new Aspose.Imaging.ImageOptions.ApngOptions();
// Save djvu to apng
image.Save(Path.Combine(templatesFolder, "output.apng"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.apng"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of BmpOptions
var exportOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
// Save djvu to bmp
image.Save(Path.Combine(templatesFolder, "output.bmp"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.bmp"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of DicomOptions
var exportOptions = new Aspose.Imaging.ImageOptions.DicomOptions();
// Save djvu to dicom
image.Save(Path.Combine(templatesFolder, "output.dicom"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.dicom"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of DxfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.DxfOptions(){ TextAsLines = true,ConvertTextBeziers = true};
// Save djvu to dxf
image.Save(Path.Combine(templatesFolder, "output.dxf"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.dxf"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of EmfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.EmfOptions();
// Save djvu to emf
image.Save(Path.Combine(templatesFolder, "output.emf"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.emf"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of EmfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.EmfOptions(){ Compress = true };
// Save djvu to emz
image.Save(Path.Combine(templatesFolder, "output.emz"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.emz"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of GifOptions
var exportOptions = new Aspose.Imaging.ImageOptions.GifOptions();
// Save djvu to gif
image.Save(Path.Combine(templatesFolder, "output.gif"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.gif"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of Html5CanvasOptions
var exportOptions = new Aspose.Imaging.ImageOptions.Html5CanvasOptions();
// Save djvu to html
image.Save(Path.Combine(templatesFolder, "output.html"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.html"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of IcoOptions
var exportOptions = new Aspose.Imaging.ImageOptions.IcoOptions();
// Save djvu to ico
image.Save(Path.Combine(templatesFolder, "output.ico"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.ico"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of Jpeg2000Options
var exportOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options(){ Codec = Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.J2K };
// Save djvu to j2k
image.Save(Path.Combine(templatesFolder, "output.j2k"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.j2k"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of Jpeg2000Options
var exportOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options(){ Codec = Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Codec.Jp2 };
// Save djvu to jp2
image.Save(Path.Combine(templatesFolder, "output.jp2"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.jp2"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of JpegOptions
var exportOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
// Save djvu to jpeg
image.Save(Path.Combine(templatesFolder, "output.jpeg"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.jpeg"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of Jpeg2000Options
var exportOptions = new Aspose.Imaging.ImageOptions.Jpeg2000Options();
// Save djvu to jpeg2000
image.Save(Path.Combine(templatesFolder, "output.jpeg2000"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.jpeg2000"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of JpegOptions
var exportOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
// Save djvu to jpg
image.Save(Path.Combine(templatesFolder, "output.jpg"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.jpg"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of PdfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.PdfOptions();
// Save djvu to pdf
image.Save(Path.Combine(templatesFolder, "output.pdf"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.pdf"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of PngOptions
var exportOptions = new Aspose.Imaging.ImageOptions.PngOptions(){ ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha};
// Save djvu to png
image.Save(Path.Combine(templatesFolder, "output.png"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.png"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of PsdOptions
var exportOptions = new Aspose.Imaging.ImageOptions.PsdOptions();
// Save djvu to psd
image.Save(Path.Combine(templatesFolder, "output.psd"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.psd"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of SvgOptions
var exportOptions = new Aspose.Imaging.ImageOptions.SvgOptions();
// Save djvu to svg
image.Save(Path.Combine(templatesFolder, "output.svg"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.svg"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of SvgOptions
var exportOptions = new Aspose.Imaging.ImageOptions.SvgOptions(){ Compress = true };
// Save djvu to svgz
image.Save(Path.Combine(templatesFolder, "output.svgz"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.svgz"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of TgaOptions
var exportOptions = new Aspose.Imaging.ImageOptions.TgaOptions();
// Save djvu to tga
image.Save(Path.Combine(templatesFolder, "output.tga"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.tga"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of TiffOptions
var exportOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Save djvu to tif
image.Save(Path.Combine(templatesFolder, "output.tif"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.tif"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of TiffOptions
var exportOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Save djvu to tiff
image.Save(Path.Combine(templatesFolder, "output.tiff"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.tiff"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of WebPOptions
var exportOptions = new Aspose.Imaging.ImageOptions.WebPOptions();
// Save djvu to webp
image.Save(Path.Combine(templatesFolder, "output.webp"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.webp"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of WmfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.WmfOptions();
// Save djvu to wmf
image.Save(Path.Combine(templatesFolder, "output.wmf"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.wmf"));
}
using Aspose.Imaging;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// Load the djvu file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, @"template.djvu")))
{
// Create an instance of WmfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.WmfOptions(){ Compress = true };
// Save djvu to wmz
image.Save(Path.Combine(templatesFolder, "output.wmz"), exportOptions);
File.Delete(Path.Combine(templatesFolder, "output.wmz"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment