Saving image to file

You could try to save the image using this approach SaveFileDialog dialog=new SaveFileDialog(); if (dialog.ShowDialog()==DialogResult.OK) { int width = Convert.ToInt32(drawImage.Width); int height = Convert.ToInt32(drawImage.Height); using(Bitmap bmp = new Bitmap(width, height)) { drawImage.DrawToBitmap(bmp, new Rectangle(0, 0, width, height)); bmp.Save(dialog.FileName, ImageFormat.Jpeg); } }

Excel, save and close after run

This worked for me : $workbook.Close($false) $excel.Quit() [System.GC]::Collect() [System.GC]::WaitForPendingFinalizers() [System.Runtime.Interopservices.Marshal]::ReleaseComObject($workSheet) [System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) Remove-Variable -Name excel

How to force save as dialog box in firefox besides changing headers?

If you can output the file to the client in base64, you could use data uris to for the download. location.href=”https://stackoverflow.com/questions/833068/data:application/octet-stream;base64,” + appendPDFContentHere OR <a href=”data:application/octet-stream;base64,appendPDFContentHere”>pdf</a> This will only work in non-IE browsers however but as you requested for firefox, this should work nicely. EDIT: Both of the examples below contain the bytes to make … Read more

Android how to save a bitmap – buggy code

Here is the code for a serialization with memory optimisation. Im using a static buffer that is growing to the biggest bitmap size and that I reuse each time. public class Video implements Serializable{ public long videoId; public String title; public String publisher; public String language; public Date lastModified; public Date published; public String imageUrl; … Read more

Easiest way of saving wpf Image control to a file

You could use RenderTargetBitmap class and BitmapEncoder. Define these methods: void SaveToBmp(FrameworkElement visual, string fileName) { var encoder = new BmpBitmapEncoder(); SaveUsingEncoder(visual, fileName, encoder); } void SaveToPng(FrameworkElement visual, string fileName) { var encoder = new PngBitmapEncoder(); SaveUsingEncoder(visual, fileName, encoder); } // and so on for other encoders (if you want) void SaveUsingEncoder(FrameworkElement visual, string fileName, … Read more

In Matlab, is it possible to terminate a script, but save all its internal variables to workspace?

MATLAB versions 2016a and later If you are using post 2016a versions of Matlab there is actually a pause button that appears when you run the script (as described by @pedre). This allows you to pause the script, inspect variables and then resume afterwards. Make sure to check out the next section as this may … Read more