Ejemplo n.º 1
0
        public static string ConvertWebPToTempPngFile(string webPPath)
        {
            string tempIcon = ApplicationDataUtils.GenerateNonExistentFilePath(extension: ".png");

            IOUtils.EnsureParentDirExists(tempIcon);
            using (var webP = new WebP())
                webP.Load(webPPath).Save(tempIcon, ImageFormat.Png);
            return(tempIcon);
        }
Ejemplo n.º 2
0
        public static string ConvertImageToTempWebPFile(Bitmap imageBitmap, bool lossless)
        {
            string tempIcon = ApplicationDataUtils.GenerateNonExistentFilePath(extension: ".webp");

            IOUtils.EnsureParentDirExists(tempIcon);
            using (var webP = new WebP())
            {
                File.WriteAllBytes(
                    tempIcon,
                    lossless
                        ? webP.EncodeLossless(imageBitmap, speed: 9)
                        : webP.EncodeLossy(imageBitmap, quality: 75, speed: 9)
                    );
            }

            return(tempIcon);
        }