Example #1
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                var dir = args[0];
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                Directory.SetCurrentDirectory(dir);
            }

            // http://msdn.microsoft.com/en-us/library/windows/desktop/aa511280.aspx#size
            // https://github.com/audreyr/favicon-cheat-sheet
            // https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/IconMatrix.html
            var sizes = new List<int>();

            // Standard icon sizes
            sizes.AddRange(new[] { 256, 64, 48, 32, 24, 16 });

            // Windows store app
            sizes.AddRange(new[] { 150, 310, 126, 98, 70, 56, 270, 210, 120, 558, 434, 310, 248, 54, 42, 30, 24, 256, 48, 32, 16, 90, 70, 50, 43, 33, 24, 1116, 540, 868, 420, 620, 300 });

            // Apple OS X?
            sizes.AddRange(new[] { 1024, 44, 22, 25 });

            // Apple App icons
            sizes.Add(57); // iPhone iOS 5-6
            sizes.Add(114); // iPhone @2x iOS 5-6
            sizes.Add(120); // iPhone @2x iOS 7
            sizes.Add(72); // iPad iOS 5-6
            sizes.Add(144); // iPad @2x iOS 5-6
            sizes.Add(76); // iPad iOS 7
            sizes.Add(152); // iPad @2x iOS 7

            // Apple Spotlight & Settings icons
            sizes.Add(29); // iPhone Spotlight iOS 5,6 + Settings iOS 5-7
            sizes.Add(58); // iPhone Spotlight @2x iOS 5,6 + Settings @2x iOS 5-7
            sizes.Add(50); // iPad Spotlight iOS 5-6
            sizes.Add(100); // iPad Spotlight @2x iOS 5-6
            sizes.Add(40); // Spotlight iOS 7
            sizes.Add(80); // Spotlight @2x 7

            // Other
            sizes.AddRange(new[] { 512, 256, 248, 228, 195, 144, 128, 114, 100, 96, 72, 57, 42, 40, 33, 20 });
            sizes.AddRange(new[] { 2048 }); // Really big
            pngOptimizer = Path.GetFullPath(@"TruePNG.exe");

            var iconRenderer = new Candidate5();
            bool generateSvg = false;

            foreach (var size in sizes.Distinct().OrderBy(x => x))
            {
                // CreateBitmap(size, icon1, string.Format("v1_{0}.png", size));
                var pngFile = string.Format("OxyPlot_{0}.png", size);
                var svgFile = string.Format("OxyPlot_{0}.svg", size);
                Console.WriteLine("Generating {0}x{0} icon", size);
                if (generateSvg)
                {
                    Console.WriteLine("  Saving {0}", svgFile);
                    CreateSvg(size, iconRenderer, svgFile);
                }

                Console.WriteLine("  Saving {0}", pngFile);
                CreateBitmap(size, iconRenderer, pngFile);
                Console.WriteLine("  Optimizing {0}", pngFile);
                OptimizePng(pngFile);
                Console.WriteLine();
            }

            var icon = new IcoMaker.Icon();
            icon.AddImage("OxyPlot_16.png");
            icon.AddImage("OxyPlot_24.png");
            icon.AddImage("OxyPlot_32.png");
            icon.AddImage("OxyPlot_48.png");
            icon.AddImage("OxyPlot_64.png");
            icon.AddImage("OxyPlot_256.png");
            icon.Save("OxyPlot.ico");

            var favIcon = new IcoMaker.Icon();
            favIcon.AddImage("OxyPlot_16.png");
            favIcon.AddImage("OxyPlot_32.png");
            favIcon.AddImage("OxyPlot_48.png");
            favIcon.AddImage("OxyPlot_64.png");
            favIcon.Save("favicon.ico");

            // Process.Start("Explorer.exe", "/select," + Path.GetFullPath("OxyPlot.ico"));
        }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                var dir = args[0];
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                Directory.SetCurrentDirectory(dir);
            }

            // http://msdn.microsoft.com/en-us/library/windows/desktop/aa511280.aspx#size
            // https://github.com/audreyr/favicon-cheat-sheet
            // https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/IconMatrix.html
            var sizes = new List <int>();

            // Standard icon sizes
            sizes.AddRange(new[] { 256, 64, 48, 32, 24, 16 });

            // Windows store app
            sizes.AddRange(new[] { 150, 310, 126, 98, 70, 56, 270, 210, 120, 558, 434, 310, 248, 54, 42, 30, 24, 256, 48, 32, 16, 90, 70, 50, 43, 33, 24, 1116, 540, 868, 420, 620, 300 });

            // Apple OS X?
            sizes.AddRange(new[] { 1024, 44, 22, 25 });

            // Apple App icons
            sizes.Add(57);  // iPhone iOS 5-6
            sizes.Add(114); // iPhone @2x iOS 5-6
            sizes.Add(120); // iPhone @2x iOS 7
            sizes.Add(72);  // iPad iOS 5-6
            sizes.Add(144); // iPad @2x iOS 5-6
            sizes.Add(76);  // iPad iOS 7
            sizes.Add(152); // iPad @2x iOS 7

            // Apple Spotlight & Settings icons
            sizes.Add(29);  // iPhone Spotlight iOS 5,6 + Settings iOS 5-7
            sizes.Add(58);  // iPhone Spotlight @2x iOS 5,6 + Settings @2x iOS 5-7
            sizes.Add(50);  // iPad Spotlight iOS 5-6
            sizes.Add(100); // iPad Spotlight @2x iOS 5-6
            sizes.Add(40);  // Spotlight iOS 7
            sizes.Add(80);  // Spotlight @2x 7

            // Other
            sizes.AddRange(new[] { 512, 256, 248, 228, 195, 144, 128, 114, 100, 96, 72, 57, 42, 40, 33, 20 });
            sizes.AddRange(new[] { 2048 }); // Really big
            pngOptimizer = Path.GetFullPath(@"TruePNG.exe");

            var  iconRenderer = new Candidate5();
            bool generateSvg  = false;

            foreach (var size in sizes.Distinct().OrderBy(x => x))
            {
                // CreateBitmap(size, icon1, string.Format("v1_{0}.png", size));
                var pngFile = string.Format("OxyPlot_{0}.png", size);
                var svgFile = string.Format("OxyPlot_{0}.svg", size);
                Console.WriteLine("Generating {0}x{0} icon", size);
                if (generateSvg)
                {
                    Console.WriteLine("  Saving {0}", svgFile);
                    CreateSvg(size, iconRenderer, svgFile);
                }

                Console.WriteLine("  Saving {0}", pngFile);
                CreateBitmap(size, iconRenderer, pngFile);
                Console.WriteLine("  Optimizing {0}", pngFile);
                OptimizePng(pngFile);
                Console.WriteLine();
            }

            var icon = new IcoMaker.Icon();

            icon.AddImage("OxyPlot_16.png");
            icon.AddImage("OxyPlot_24.png");
            icon.AddImage("OxyPlot_32.png");
            icon.AddImage("OxyPlot_48.png");
            icon.AddImage("OxyPlot_64.png");
            icon.AddImage("OxyPlot_256.png");
            icon.Save("OxyPlot.ico");

            var favIcon = new IcoMaker.Icon();

            favIcon.AddImage("OxyPlot_16.png");
            favIcon.AddImage("OxyPlot_32.png");
            favIcon.AddImage("OxyPlot_48.png");
            favIcon.AddImage("OxyPlot_64.png");
            favIcon.Save("favicon.ico");

            // Process.Start("Explorer.exe", "/select," + Path.GetFullPath("OxyPlot.ico"));
        }