diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-10 20:34:37 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-10 20:34:37 +0300 |
| commit | 10a60c85181ba12f7cc1d84f23f6d6771faaae3d (patch) | |
| tree | fac4d39f297fbfefda39cc670931a0d16237e86f /Software/Visual_Studio/Tango.Core | |
| parent | e96ac0051590493eb23760aff71e3242fd88adf1 (diff) | |
| download | Tango-10a60c85181ba12f7cc1d84f23f6d6771faaae3d.tar.gz Tango-10a60c85181ba12f7cc1d84f23f6d6771faaae3d.zip | |
Working on TCC...
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs index 3cca605e9..34e3d9ea2 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs @@ -20,5 +20,13 @@ public static class BitmapExtensions var encParams = new EncoderParameters() { Param = new[] { new EncoderParameter(Encoder.Quality, quality) } }; bitmap.Save(filePath, encoder, encParams); } + + public static Bitmap ConvertTo24Bit(this Bitmap bitmap) + { + var bmp = new Bitmap(bitmap.Width, bitmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + using (var gr = Graphics.FromImage(bmp)) + gr.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); + return bmp; + } } |
