Converting a byte array to PNG/JPG [closed]

You should be able to do something like this: using System.Drawing.Imaging; using System.Drawing; using System.IO; byte[] bitmap = GetYourImage(); using(Image image = Image.FromStream(new MemoryStream(bitmap))) { image.Save(“output.jpg”, ImageFormat.Jpeg); // Or Png } Look here for more info. Hopefully this helps.

Favicon: .ico or .png / correct tags? [duplicate]

For compatibility with all browsers stick with .ico. .png is getting more and more support though as it is easier to create using multiple programs. for .ico <link rel=”shortcut icon” href=”http://example.com/myicon.ico” /> for .png, you need to specify the type <link rel=”icon” type=”image/png” href=”http://example.com/image.png” />

I have a base64 encoded png, how do I write the image to a file in PHP?

You need to use base64_decode(). AND. Sometimes it is not sufficient. Here is all code that you need: $img = $_POST[‘data’]; $img = str_replace(‘data:image/png;base64,’, ”, $img); $img = str_replace(‘ ‘, ‘+’, $img); $fileData = base64_decode($img); //saving $fileName=”photo.png”; file_put_contents($fileName, $fileData); P.S. I used this code to get PNG image from html canvas.