public void ImageWithSize()
        {
            // trying to reproduce issue from bug #23619 - but turned out to be an iOS8 bug
            string file = Path.Combine(NSBundle.MainBundle.ResourcePath, "basn3p08.png");

            using (var img = UIImage.FromFile(file))
                using (var mia = new MPMediaItemArtwork(img)) {
                    Assert.That(img.Size.ToString(), Is.EqualTo("{Width=32, Height=32}"), "original");
                    var upscale = mia.ImageWithSize(new CGSize(100, 100));
                    Assert.That(upscale.Size.ToString(), Is.EqualTo("{Width=32, Height=32}"), "upscale");
                    var downscale = mia.ImageWithSize(new CGSize(16, 16));
                    Assert.That(downscale.Size.ToString(), Is.EqualTo("{Width=32, Height=32}"), "downscale");
                }
        }
Esempio n. 2
0
        public MemoryStream GetTrackImageStream(MPMediaItemArtwork artWork)
        {
            MemoryStream ms         = null;
            var          imageBytes = new byte[0];

            if (artWork != null)
            {
                if (artWork != null)
                {
                    var thumb = artWork.ImageWithSize(new CGSize(100, 100));
                    if (thumb != null)
                    {
                        ms = new MemoryStream(thumb.AsPNG().ToArray());
                    }
                }
            }
            return(ms);
        }