Created
September 25, 2015 19:45
-
-
Save bjoerntx/c8063eb007d22e99894e to your computer and use it in GitHub Desktop.
This file contains 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
/*************************************************************** | |
* SplitMultipageTIFF method | |
* description: Splits a multipage TIFF into separate images | |
* | |
* param: image - the image path | |
* return val: A list of images | |
***************************************************************/ | |
private List<Image> SplitMultipageTIFF(string image) | |
{ | |
List<Image> listImages = new List<Image>(); | |
Bitmap bmp = (Bitmap)Image.FromFile(image); | |
int iCount = bmp.GetFrameCount(FrameDimension.Page); | |
for (int i = 0; i < iCount; i++) | |
{ | |
// store each frame | |
bmp.SelectActiveFrame(FrameDimension.Page, i); | |
MemoryStream byteStream = new MemoryStream(); | |
bmp.Save(byteStream, ImageFormat.Tiff); | |
// assemble new image | |
listImages.Add(Image.FromStream(byteStream)); | |
} | |
return listImages; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment