static Bitmap LoadImage()
{
return (Bitmap)Bitmap.FromFile( @"e:\Tests\d_bigImage.bmp" ); // here is large image 9222x9222 pixels and 95.96 dpi resolutions
}
static void TestBigImagePartDrawing()
{
using( var absentRectangleImage = LoadImage() )
{
using( var currentTile = new Bitmap( 256, 256 ) )
{
currentTile.SetResolution(absentRectangleImage.HorizontalResolution, absentRectangleImage.VerticalResolution);
using( var currentTileGraphics = Graphics.FromImage( currentTile ) )
{
currentTileGraphics.Clear( Color.Black );
var absentRectangleArea = new Rectangle( 3, 8963, 256, 256 );
currentTileGraphics.DrawImage( absentRectangleImage, 0, 0, absentRectangleArea, GraphicsUnit.Pixel );
}
currentTile.Save(@"e:\Tests\Tile.bmp");
}
}
}
SOURCE : https://stackoverflow.com/questions/734930/how-to-crop-an-image-using-c?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
'C#(CSharp) > Etc' 카테고리의 다른 글
c# memory cache (0) | 2018.05.26 |
---|---|
Deleting multiple files with wildcard (0) | 2018.05.17 |
Get utc time to time zone standard time (0) | 2018.04.09 |
Windows/C# Timezone List (0) | 2018.04.09 |
C# if/then directives for debug vs release (0) | 2018.04.07 |