Skip to content

Instantly share code, notes, and snippets.

@rqx110
Forked from ochilab/showMultiTiff.cs
Created December 6, 2017 12:19
Show Gist options
  • Save rqx110/e0ec616a973062aa4a25baa5dd1d20e6 to your computer and use it in GitHub Desktop.
Save rqx110/e0ec616a973062aa4a25baa5dd1d20e6 to your computer and use it in GitHub Desktop.
C#でマルチページ形式のTiff画像を表示する方法(Form編)
private void showMultiTiff(string tiffFileName){
FileStream tifFS = new FileStream( tiffFileName , FileMode.Open , FileAccess.Read ) ;
Image gim = Image.FromStream( tifFS ) ;
FrameDimension gfd = new FrameDimension(gim.FrameDimensionsList[0]);
int pageCount = gim.GetFrameCount( gfd ) ;//全体のページ数を得る
System.Diagnostics.Debug.WriteLine(pageCount);
Graphics g = pictureBox1.CreateGraphics();
for(int i=0;i<pageCount;i++){
gim.SelectActiveFrame(gfd, i);
g.DrawImage(gim, 0,0, pictureBox1.Width, pictureBox1.Height);//PictureBoxに表示してます
System.Threading.Thread.Sleep(500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment