Created
June 10, 2020 15:39
Convert GIF to TIFF, PDF and Raster Images in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
using (var image = Image.Load(@"Sample_2.gif")) | |
{ | |
// Convert frame 1 of GIF to BMP | |
image.Save("converted-to-bmp.bmp", new BmpOptions() { MultiPageOptions = new MultiPageOptions(6), FullFrame = true }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
using (var image = Image.Load(@"Sample_2.gif")) | |
{ | |
// Convert frame 1 of GIF to JPG | |
image.Save("converted-to-jpg.jpg", new JpegOptions() { MultiPageOptions = new MultiPageOptions(6), FullFrame = true }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF file | |
using (Image image = Image.Load(@"sample_2.gif")) | |
{ | |
// Convert all the frames | |
image.Save("GIF-to-PDF.pdf", new PdfOptions() { FullFrame = true }); | |
// Convert selected frames | |
image.Save("Selected-Frames-to-PDF.pdf", new PdfOptions() { MultiPageOptions = new MultiPageOptions(new IntRange(2, 5)), FullFrame = true }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
using (var image = Image.Load(@"Sample_2.gif")) | |
{ | |
// Convert frame 1 of GIF to PNG | |
image.Save("converted-to-png.png", new PngOptions() { MultiPageOptions = new MultiPageOptions(1), FullFrame = true }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF file | |
using (var image = Image.Load(@"sample_2.gif")) | |
{ | |
// Convert selected frames only | |
image.Save("Selected-Frames.tiff", new TiffOptions(TiffExpectedFormat.TiffDeflateRgb) { MultiPageOptions = new MultiPageOptions(new IntRange(1, 3)), FullFrame = true }); | |
// Convert all the frames | |
image.Save("GIF-to-TIFF.tiff", new TiffOptions(TiffExpectedFormat.TiffDeflateRgb) { FullFrame = true }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment