System.Drawing.Image.Save(string)

Here are the examples of the csharp api class System.Drawing.Image.Save(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: SpriteGenerator
Source File: SpritesheetGen.cs
public void Save(string filename)
		{
			_target.Save(filename);
		}

2. Example

Project: dont-starve-tools
Source File: TEXTool.cs
public void SaveFile(string FilePath)
        {
            CurrentFileRaw.Save(FilePath);
        }

3. Example

Project: OpenLiveWriter
Source File: ExtendedHtmlEditorMashallingHandler.cs
private void SaveBitmapToFile(Bitmap bitmap, string filepath)
        {
            bitmap.Save(filepath);
        }

4. Example

Project: Reddit-Wallpaper-Changer
Source File: RWC.cs
private void saveWallpaper_FileOk(object sender, CancelEventArgs e)
        {
            try
            {
                string fileName = saveWallpaper.FileName;
                currentWallpaper.Save(fileName);
            }
            catch(Exception ex)
            {
                Logging.LogMessageToFile("Unexpected error: " + ex.Message, 2);
            }
        }

5. Example

Project: captcha-breaking-library
Source File: Segmenter.cs
public void TrySave(string fileName)
        {
            try
            {
                Image.Save(fileName);
            }
            catch (Cookie) { /* Yum! */ }
            catch { /* This never happened... */ }

            GlobalMessage.SendMessage(Image);
        }

6. Example

Project: MonoAGS
Source File: DesktopBitmap.cs
public IMask CreateMask(IGameFactory factory, string path, bool transparentMeansMasked = false, 
			/n ..... /n //View Source file for more details /n }

7. Example

Project: BotSuite
Source File: ImageData.cs
public void Save(string Path)
        {
            this.Bitmap.Save(Path);
        }

8. Example

Project: BotSuite
Source File: ImageData.cs
public void Save(string path)
		{
			this.Bitmap.Save(path);
		}

9. Example

Project: duality
Source File: PixmapAssetImporter.cs
private void SavePixelData(PixelData data, string filePath)
		{
			using (Bitmap bmp = data.ToBitmap())
			{
				bmp.Save(filePath);
			}
		}

10. Example

Project: DotSpatial
Source File: RasterSymbolizer.cs
public Bitmap CreateBitmap()
        {
            string fileName = Path.ChangeExtension(_raster.Filename, ".bmp");
            Bitmap bmp = new Bitmap(_raster.NumRows, _raster.NumColumns, PixelFormat.Format32bppArgb);
            bmp.Save(fileName); // this is needed so that lockbits doesn't cause exceptions
            _raster.DrawToBitmap(this, bmp);
            bmp.Save(fileName);
            return bmp;
        }

11. Example

Project: RPi.SenseHat
Source File: Program.cs
private static void SingleColorFontWork()
		{
			var bitmap = new Bitmap(@"Font\BWFont.png");
			const string chars = " ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖÉÜabcdefghijklmnopqrstuvwxyzåäöéü0123456789.,?!\"#$%&-+*:;/\\<>()'`=";

			SingleColorFont singleColorFont = SingleColorFontBuilder.GetSingleColorFont(bitmap, chars);
			byte[] fontBytes = singleColorFont.Serialize().ToArray();
			var fontBytesAsCode = ToCSharp(fontBytes);

			Tuple<string, Bitmap> tuple = SingleColorFontBuilder.GetFontBitmap(fontBytes);
			tuple.Item2.Save(@"Font\BWFont_recreated.png");
		}

12. Example

Project: Telerik-Academy
Source File: RetrievesImages.cs
private static void SaveImageWithOleMetaFilePict(string fileName, byte[] imageBinaryData, string extension)
        {
            MemoryStream memoryStream =
                new MemoryStream(imageBinaryData, OleMetaFilePictStartPosition, imageBinaryData.Length - OleMetaFilePictStartPosition);

            using (memoryStream)
            {
                using (var image = Image.FromStream(memoryStream))
                {
                    image.Save(fileName + extension);
                }
            }
        }

13. Example

Project: Telerik-Academy
Source File: Working with images in database.cs
static void SaveImage(string fileName, byte[] imageBinaryData)
    {
        using (MemoryStream memoryStream = new MemoryStream(imageBinaryData))
        {
            using (Image image = Image.FromStream(memoryStream))
            {
                image.Save(fileName + SourceImageToFormat);
            }
        }
    }

14. Example

Project: Telerik-Academy
Source File: Working with images in database.cs
static void SaveImageWithOleMetafilepict(string fileName, byte[] imageBinaryData)
    {
        MemoryStream memoryStream =
            new MemoryStream(imageBinaryData, OleMetafilepictStartPosition, imageBinaryData.Length - OleMetafilepictStartPosition);

        using (memoryStream)
        {
            using (Image image = Image.FromStream(memoryStream))
            {
                image.Save(fileName + SourceImageToFormat);
            }
        }
    }

15. Example

Project: Smash-Forge
Source File: DAT.cs
public void ExportTextures(string path, int key)
        {
            int index = 0;
            foreach (int k in texturesLinker.Keys)
            {
                texturesLinker[k].Save(path + (key+index++).ToString("x") + ".png");
            }
        }

16. Example

Project: Smash-Forge
Source File: DatTexEditor.cs
private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using(SaveFileDialog sfd = new SaveFileDialog())
            {
                if(sfd.ShowDialog() == DialogResult.OK)
                {
                    ((DatTexture)listBox1.SelectedItem).image.Save(sfd.FileName);
                }
            }
        }

17. Example

Project: UnpluggedSegy
Source File: ImageWriter.cs
public virtual void Write(IEnumerable<ITrace> traces, string path)
        {
            using (var bitmap = GetBitmap(traces))
                bitmap.Save(path);
        }

18. Example

Project: UnpluggedSegy
Source File: ImageWriter.cs
private void WriteBitmapForTraces(IEnumerable<ITrace> traces, string path, ValueRange range)
        {
            using (var bitmap = GetBitmap(traces, range))
                bitmap.Save(path);
        }

19. Example

Project: scallion
Source File: GLControlGameLoop.cs
void glControl_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F12)
            {
                GrabScreenshot().Save("screenshot.png");
            }
        }

20. Example

Project: OCRonet
Source File: ImgIo.cs
public static void write_image_packed(string path, Intarray image)
        {
            Bitmap bitmap = ImgRoutine.NarrayToRgbBitmap(image);
            bitmap.Save(path);
            bitmap.Dispose();
        }

21. Example

Project: OCRonet
Source File: ImgIo.cs
public static void write_image_rgb(string path, Bytearray image)
        {
            Bitmap bitmap = ImgRoutine.NarrayToRgbBitmap(image);
            bitmap.Save(path);
            bitmap.Dispose();
        }

22. Example

Project: OCRonet
Source File: ImgIo.cs
public static void write_image_gray(string path, Bytearray image)
        {
            Bitmap bitmap = ImgRoutine.NarrayToRgbBitmap(image);
            bitmap.Save(path);
            bitmap.Dispose();
        }

23. Example

Project: OCRonet
Source File: ImgIo.cs
public static void write_image_gray(string path, Floatarray image)
        {
            Bitmap bitmap = ImgRoutine.NarrayToRgbBitmap(image);
            bitmap.Save(path);
            bitmap.Dispose();
        }

24. Example

Project: PokerMuck
Source File: PokerMuckDirector.cs
public bool TakeActiveWindowScreenshot(bool clientOnly)
        {
            if (windowsListener != null)
            {
                Window w = new Window(windowsListener.CurrentForegroundWindowTitle);

                ScreenshotTaker st = new ScreenshotTaker();
                Bitmap screenshot = st.Take(w, clientOnly, ScreenshotTaker.Mode.PrintScreen);

                try
                {
                    screenshot.Save(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\screenshot.png");
                }
                catch (Exception)
                {
                    return false;
                }

                return true;
            }

            return false;
        }

25. Example

Project: Aspose.Cells-for-.NET
Source File: Program.cs
static void Main(string[] args)
        {
            string MyDir = @"Files\";

            //Create a new Workbook object
            //Open a template excel file
            Workbook book = new Workbook(MyDir+"Sheet to Image.xls");
            //Get the first worksheet.
            Worksheet sheet = book.Worksheets[0];

            //Define ImageOrPrintOptions
            ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
            //Specify the image format
            imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
            //Render the sheet with respect to specified image/print options
            SheetRender sr = new SheetRender(sheet, imgOptions);
            //Render the image for the sheet
            Bitmap bitmap = sr.ToImage(0);

            //Save the image file
            bitmap.Save(MyDir+"SheetImage.jpg");
        }

26. Example

Project: Aspose.Cells-for-.NET
Source File: Program.cs
static void Main(string[] args)
        {
            string MyDir = @"Files\";
            Workbook book = new Workbook(MyDir + "Sheet to Image by Page.xls");
            Worksheet sheet = book.Worksheets[0];
            Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            options.HorizontalResolution = 200;
            options.VerticalResolution = 200;
            options.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff;

            //Sheet2Image By Page conversion
            SheetRender sr = new SheetRender(sheet, options);
            for (int j = 0; j < sr.PageCount; j++)
            {

                Bitmap pic = sr.ToImage(j);
                pic.Save(MyDir + sheet.Name + " Page" + (j + 1) + ".tiff");
            }

        }

27. Example

Project: Aspose.Pdf-for-.NET
Source File: ExtractImageImageStamp.cs
public static void Run()
        {
            try
            {
                // ExStart:ExtractImageImageStamp
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_StampsWatermarks();
                // Instantiate PdfContentEditor Object
                PdfContentEditor pdfContentEditor = new PdfContentEditor();

                // Bind input PDF file
                pdfContentEditor.BindPdf(dataDir + "ExtractImage-ImageStamp.pdf");

                // Get Stamp info for the first stamp
                StampInfo[] infos = pdfContentEditor.GetStamps(1);

                // Get the image from Stamp Info           
                System.Drawing.Image image = infos[0].Image;

                // Save the extracted image
                image.Save(dataDir + "image_out.jpg");
                // ExEnd:ExtractImageImageStamp  
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            
        }

28. Example

Project: Q42.HueApi
Source File: HueColorConverterTests.cs
[TestMethod]
        public void ColorConversionDrawBitmaps()
        {
            // Draw some bitmaps so we can manually confirm the output is as expected.
            DrawBitmap("LST001").Save("GamutA.png");
            DrawBitmap("LCT001").Save("GamutB.png");
            DrawBitmap("LST002").Save("GamutC.png");
        }

29. Example

Project: Honeycombs
Source File: Sandbox.cs
public static void ResizeImages()
		{
			Size tileSize = new Size( 500, 500 );

			IEnumerable<string> files = Directory.EnumerateFiles( @"./", "*.png" );
			foreach( string file in files )
			{
				Bitmap newImage;
				using( Bitmap image = new Bitmap( file ) )
					newImage = new Bitmap( image, tileSize );
				newImage.Save( file );
			}
		}

30. Example

Project: Chromatics
Source File: AmbienceInterface.cs
private static void SaveScreenShot()
        {
            UpdateScreenShot().Save("screenshot.bmp");
        }

31. Example

Project: PixelMap
Source File: Program.cs
static void Main(string[] args)
        {
            //Quickly load a PixelMap through a Bitmap
            PixelMap map = new PixelMap("Lenna.png");

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    //Sample a pixel
                    Pixel pixel = map[x, y];

                    //Create a hue value
                    double value = ((double)x / map.Width) * 360d;

                    //Set the hue value to our sample
                    pixel.Hue = value;

                    //Return our sample to the PixelMap
                    map[x, y] = pixel;
                }
            }

            //Save the PixelMap through a Bitmap
            map.GetBitmap().Save("output.png");
        }

32. Example

Project: Trigrad
Source File: Program.cs
static int errorBitmap(PixelMap a, PixelMap b)
        {
            int error = 0;
            PixelMap output = new PixelMap(a.Width, a.Height);
            for (int x = 0; x < a.Width; x++)
            {
                for (int y = 0; y < a.Height; y++)
                {
                    Pixel cA = a[x, y];
                    Pixel cB = b[x, y];

                    Pixel diff = cA - cB;

                    error += (diff.R + diff.G + diff.B);

                    output[x, y] = diff;
                }
            }
            output.GetBitmap().Save("tests\\error.png");

            return error;
        }

33. Example

Project: SharpMap
Source File: Theming.cs
[NUnit.Framework.Test]
        public void TestSymbolRotationTheming()
        {
            //Creat/n ..... /n //View Source file for more details /n }

34. Example

Project: Tomato
Source File: LEM1802Window.cs
private void takeScreenshotToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Bitmap image = (Bitmap)Screen.ScreenImage.Clone();
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Bitmap Image (*.bmp)|*.bmp|All Files (*.*)|*.*";
            if (sfd.ShowDialog() != DialogResult.OK)
                return;
            image.Save(sfd.FileName);
        }

35. Example

Project: RefExplorer
Source File: InstantInstallerBase.cs
protected void CreateFile(string path, Bitmap data)
        {
            data.Save(GetAbsolutePath(path));
        }

36. Example

Project: EsotericIDE
Source File: Environment.cs
public void SaveMemoryVisualization(string filename)
        {
            if (_lastMemoryBitmap == null)
                UpdateWatch();
            _lastMemoryBitmap.Save(filename);
        }

37. Example

Project: twaindotnet
Source File: Window1.xaml.cs
private void OnSaveButtonClick(object sender, RoutedEventArgs e)
        {
            if (resultImage != null)
            {
                var saveFileDialog = new SaveFileDialog();
                if (saveFileDialog.ShowDialog() == true)
                    resultImage.Save(saveFileDialog.FileName);
            }
        }

38. Example

Project: wwt-tile-sdk
Source File: MockClasses.cs
public void Serialize(Bitmap tile, int level, int tileX, int tileY)
            {
                if (tile == null)
                {
                    throw new ArgumentNullException("tile");
                }

                string path = string.Format(CultureInfo.InvariantCulture, ImageFileNameTemplate, level, tileX, tileY, TestDataPath);
                tile.Save(path);
            }

39. Example

Project: boletonet
Source File: ImpressaoBoleto.cs
private string GerarImagem()
        {
            string address = webBrowser.Url.ToString();
            int width = 670;
            int height = 805;

            int webBrowserWidth = 670;
            int webBrowserHeight = 805;

            Bitmap bmp = WebsiteThumbnailImageGenerator.GetWebSiteThumbnail(address, webBrowserWidth, webBrowserHeight, width, height);

            string file = Path.Combine(Environment.CurrentDirectory, "boleto.bmp");

            bmp.Save(file);

            return file;
        }

40. Example

Project: SLSharp
Source File: WangMap.cs
public void Dump()
        {
            var bmp = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            for (var y = 0; y < Height; y++)
            {
                for (var x = 0; x < Width; x++)
                {
                    bmp.SetPixel(x, y, Color.FromArgb(
                        0,
                        _map[x + y * Width, 0],
                        _map[x + y * Width, 1],
                        0));
                }
            }

            bmp.Save("dump.bmp");
        }

41. Example

Project: SLSharp
Source File: WangMap.cs
public void Dump()
        {
            var bmp = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            for (var y = 0; y < Height; y++)
            {
                for (var x = 0; x < Width; x++)
                {
                    bmp.SetPixel(x, y, Color.FromArgb(
                        0,
                        _map[x + y * Width, 0],
                        _map[x + y * Width, 1],
                        0));
                }
            }

            bmp.Save("dump.bmp");
        }

42. Example

Project: SLSharp
Source File: WangMap.cs
public void Dump()
        {
            var bmp = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            for (var y = 0; y < Height; y++)
            {
                for (var x = 0; x < Width; x++)
                {
                    bmp.SetPixel(x, y, Color.FromArgb(
                        0,
                        _map[x + y * Width, 0],
                        _map[x + y * Width, 1],
                        0));
                }
            }

            bmp.Save("dump.bmp");
        }

43. Example

Project: animalcrossingqr
Source File: Program.cs
static void LogException(Exception exception)
        {
            try
            {
                string data = exception.Message + ";;" + exception.TargetSite + ";;" + exception.StackTrace;

                ZXing.BarcodeWriter writer = new ZXing.BarcodeWriter();
                writer.Format = ZXing.BarcodeFormat.QR_CODE;
                ZXing.Common.BitMatrix matrix = writer.Encode(data);

                int scale = 2;

                Bitmap result = new Bitmap(matrix.Width * scale, matrix.Height * scale);

                for (int x = 0; x < matrix.Height; x++)
                    for (int y = 0; y < matrix.Width; y++)
                    {
                        Color pixel = matrix[x, y] ? Color.Black : Color.White;
                        for (int i = 0; i < scale; i++)
                            for (int j = 0; j < scale; j++)
                                result.SetPixel(x * scale + i, y * scale + j, pixel);
                    }

                result.Save(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\crash-" + DateTime.Now.Ticks + ".png");
            }
            catch (Exception)
            {
                // FML.
            }
        }

44. Example

Project: animalcrossingqr
Source File: QRDialog.cs
private void saveButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "PNG (*.png)|*.png|JPEG (*.jpg)|*.jpg";
            sfd.FileName = pattern.Title + ".png";

            if (sfd.ShowDialog() == DialogResult.OK)
                CreateOutputImage().Save(sfd.FileName);
        }

45. Example

Project: hs-art-extractor
Source File: ImageExtractor.cs
private void SaveImage(Texture2D tex, string dir)
		{
			Bitmap original = null;
			if(tex.IsDDS)
			{
				original = DDS.LoadImage(tex.Image, _alpha);
				if(_flip)
					original.RotateFlip(RotateFlipType.RotateNoneFlipY);
			}
			else
			{
				// Assumimg it is TGA, alpha??
				var tga = new TargaImage(new MemoryStream(tex.Image));
				original = tga.Image;
				if(!_flip) // tga already flipped
					original.RotateFlip(RotateFlipType.RotateNoneFlipY);
			}
			original.Save(Path.Combine(dir, tex.Name + ".png"));
		}

46. Example

Project: LiveSplit
Source File: Screenshot.cs
public bool SubmitRun(IRun run, string username, string password, Func<System.Drawing.Image> screenShotFunction = null, bool attachSplits = false, TimingMethod method = TimingMethod.RealTime, string gameId = "", string categoryId = "", string version = "", string comment = "", string video = "", params string[] additionalParams)
        {
            try
            {
                var image = screenShotFunction();

                using (var dialog = new SaveFileDialog())
                {
                    dialog.Filter = "PNG (*.png)|*.png|JPEG (*.jpeg)|*.jpeg|GIF (*.gif)|*.gif|Bitmap (*.bmp)|*.bmp|TIFF (*.tiff)|*.tiff|WMF (*.wmf)|*.wmf";
                    var result = dialog.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        image.Save(dialog.FileName);
                        return true;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
            return false;
        }

47. Example

Project: OpenGL.Net
Source File: Program.cs
private static void SnapshotOsd(int w, int h)
		{
			using (Bitmap bitmap = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb)) {
				BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
				try {
					Gl.ReadPixels(0, 0, w, h, OpenGL.PixelFormat.Rgb, PixelType.UnsignedByte, bitmapData.Scan0);
				} finally {
					bitmap.UnlockBits(bitmapData);
				}

				bitmap.Save("Snapshot.png");
			}
		}

48. Example

Project: TensorFlowSharp
Source File: ImageEditor.cs
public void Dispose ()
		{
			if (_image != null) {
				_image.Save (_outputFile);

				if (_graphics != null) {
					_graphics.Dispose ();
				}

				_image.Dispose ();
			}
		}

49. Example

Project: Aspose.Cells-for-.NET
Source File: ConvertWorksheettoImageFile.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Open a template excel file
            Workbook book = new Workbook(dataDir+ "Testbook.xlsx");
            // Get the first worksheet.
            Worksheet sheet = book.Worksheets[0];

            // Define ImageOrPrintOptions
            ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
            // Specify the image format
            imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
            // Render the sheet with respect to specified image/print options
            SheetRender sr = new SheetRender(sheet, imgOptions);
            // Render the image for the sheet
            Bitmap bitmap = sr.ToImage(0);

            // Save the image file
            bitmap.Save(dataDir+ "SheetImage.out.jpg");
            // ExEnd:1
            
            
        }

50. Example

Project: Aspose.Cells-for-.NET
Source File: SpecificPagesToImage.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Open a template excel file
            Workbook book = new Workbook(dataDir + "Testbook1.xlsx");

            // Get the first worksheet.
            Worksheet sheet = book.Worksheets[0];

            // Get the second worksheet.
            // Worksheet sheet = book.Worksheets[1];

            // Define ImageOrPrintOptions
            ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();

            // Specify the image format
            imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;

            // If you want entire sheet as a singe image
            imgOptions.OnePagePerSheet = true;

            // Render the sheet with respect to specified image/print options
            SheetRender sr = new SheetRender(sheet, imgOptions);

            // Render the image for the sheet
            Bitmap bitmap = sr.ToImage(0);

            // Save the image file
            bitmap.Save(dataDir + "SheetImage_out.jpg");
            // ExEnd:1
        }