PNGDecrush icon indicating copy to clipboard operation
PNGDecrush copied to clipboard

Online Converter

Open reitowo opened this issue 4 years ago • 0 comments

I put this code work on my own server, feel free to use. I will not save any image on my server. https://ez.schwarzer.wang/tools/pngdecrush

Source code:

public ActionResult PngDeCrush()
{
    if (Request.Files.Count == 0)
        return View("PngDeCrush");
    else
    {
        try
        {
            Stream macPng = Request.Files["pngfile"].InputStream;
            MemoryStream standardPng = new MemoryStream(); 
            PNGDecrusher.Decrush(macPng, standardPng);
            standardPng.Seek(0, SeekOrigin.Begin);
            return new FileStreamResult(standardPng, "image/png")
            {
                FileDownloadName = "decrushed.png"
            };
        }
        catch(Exception)
        {
            return View("PngDeCrush");
        }
    }
}

reitowo avatar Jul 14 '20 10:07 reitowo