Exemplo n.º 1
0
        public byte[] SaveBytes(ImageFormat format)
        {
            // TODO: for Windows you can save a stream. Need to look into Cairo, but this may be the only way for OSX.
            string seed = IdGenerator.GetRandomSeed();
            string file = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "crayon-" + IdGenerator.Generate32HexDigits(seed, "image") + FormatToExtension(format));

            this.Save(file);
            byte[] bytes = System.IO.File.ReadAllBytes(file);
            System.IO.File.Delete(file);
            return(bytes);
        }