Esempio n. 1
0
        public long Serialize(Stream stream, ToImageT value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            var img = transcoder.Translate(value);

            return(codec.Serialize(stream, img));
        }
Esempio n. 2
0
        public async Task PNGImageSizeAsync()
        {
            var imageRequest = new ImageRequest(apiKey, signingKey, new Size(640, 640))
            {
                Place = "Alexandria, VA"
            };

            var rawImg = await cache
                         .LoadAsync(jpegDecoder, imageRequest)
                         .ConfigureAwait(false);

            var data = pngDecoder.Serialize(rawImg);
            var info = ImageInfo.ReadPNG(data);

            Assert.AreEqual(640, info.Dimensions.Width);
            Assert.AreEqual(640, info.Dimensions.Height);
        }