示例#1
0
        public static ArtistArt FromUrl(string title, string url, out ImageLoadResults status)
        {
            DBArtistInfo mv = new DBArtistInfo();

            mv.Artist = title;
            return(FromUrl(mv, url, false, out status));
        }
示例#2
0
        public static Backdrop FromUrl(DBMovieInfo movie, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (!ignoreRestrictions) {
                minSize = new ImageSize();
                minSize.Width = MovingPicturesCore.Settings.MinimumBackdropWidth;
                minSize.Height = MovingPicturesCore.Settings.MinimumBackdropHeight;
            }

            maxSize.Width = MovingPicturesCore.Settings.MaximumBackdropWidth;
            maxSize.Height = MovingPicturesCore.Settings.MaximumBackdropHeight;

            bool redownload = MovingPicturesCore.Settings.RedownloadBackdrops;

            Backdrop newBackdrop = new Backdrop();
            newBackdrop.Filename = GenerateFilename(movie, url);
            status = newBackdrop.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status) {
                case ImageLoadResults.SUCCESS:
                    logger.Info("Added backdrop for \"{0}\" from: {1}", movie.Title, url);
                    break;
                case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                    logger.Info("Added resized backdrop for \"{0}\" from: {1}", movie.Title, url);
                    break;
                case ImageLoadResults.FAILED_ALREADY_LOADED:
                    logger.Debug("Backdrop for \"{0}\" from the following URL is already loaded: {1}", movie.Title, url);
                    return null;
                case ImageLoadResults.FAILED_TOO_SMALL:
                    logger.Debug("Downloaded backdrop for \"{0}\" failed minimum resolution requirements: {1}", movie.Title, url);
                    return null;
                case ImageLoadResults.FAILED:
                    logger.Error("Failed downloading backdrop for \"{0}\": {1}", movie.Title, url);
                    return null;
            }

            return newBackdrop;
        }
示例#3
0
        public static ArtistArt FromUrl(DBArtistInfo mv, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (!ignoreRestrictions) {
                minSize = new ImageSize();
                minSize.Width = MusicVideosCore.Settings.MinimumArtistWidth;
                minSize.Height = MusicVideosCore.Settings.MinimumArtistHeight;
            }

            maxSize.Width = MusicVideosCore.Settings.MaximumArtistWidth;
            maxSize.Height = MusicVideosCore.Settings.MaximumArtistHeight;

            bool redownload = MusicVideosCore.Settings.RedownloadArtistArtwork;

            ArtistArt newArtistart = new ArtistArt();
            newArtistart.Filename = GenerateFilename(mv, url);
            status = newArtistart.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status) {
                case ImageLoadResults.SUCCESS:
                    logger.Info("Added artist art for \"{0}\" from: {1}", mv.Artist, url);
                    break;
                case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                    logger.Debug("Added resized artist art for \"{0}\" from: {1}", mv.Artist, url);
                    break;
                case ImageLoadResults.FAILED_ALREADY_LOADED:
                    logger.Debug("Artist art for \"{0}\" from the following URL is already loaded: {1}", mv.Artist, url);
                    return null;
                case ImageLoadResults.FAILED_TOO_SMALL:
                    logger.Error("Downloaded artist art for \"{0}\" failed minimum resolution requirements: {1}", mv.Artist, url);
                    return null;
                case ImageLoadResults.FAILED:
                    logger.Error("Failed downloading artist art for \"{0}\": {1}", mv.Artist, url);
                    return null;
            }

            return newArtistart;
        }
示例#4
0
 public static BasicArt FromFile(DBBasicInfo mv, string path, out ImageLoadResults status)
 {
     return(FromFile(mv, path, false, out status));
 }
示例#5
0
 public static BasicArt FromUrl(string title, string url, out ImageLoadResults status)
 {
     return FromUrl(mvs, url, false, out status);
 }
示例#6
0
        public static ArtistArt FromUrl(DBArtistInfo mv, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (!ignoreRestrictions)
            {
                minSize        = new ImageSize();
                minSize.Width  = MusicVideosCore.Settings.MinimumArtistWidth;
                minSize.Height = MusicVideosCore.Settings.MinimumArtistHeight;
            }

            maxSize.Width  = MusicVideosCore.Settings.MaximumArtistWidth;
            maxSize.Height = MusicVideosCore.Settings.MaximumArtistHeight;

            bool redownload = MusicVideosCore.Settings.RedownloadArtistArtwork;

            ArtistArt newArtistart = new ArtistArt();

            newArtistart.Filename = GenerateFilename(mv, url);
            status = newArtistart.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status)
            {
            case ImageLoadResults.SUCCESS:
                logger.Info("Added artist art for \"{0}\" from: {1}", mv.Artist, url);
                break;

            case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                logger.Debug("Added resized artist art for \"{0}\" from: {1}", mv.Artist, url);
                break;

            case ImageLoadResults.FAILED_ALREADY_LOADED:
                logger.Debug("Artist art for \"{0}\" from the following URL is already loaded: {1}", mv.Artist, url);
                return(null);

            case ImageLoadResults.FAILED_TOO_SMALL:
                logger.Error("Downloaded artist art for \"{0}\" failed minimum resolution requirements: {1}", mv.Artist, url);
                return(null);

            case ImageLoadResults.FAILED:
                logger.Error("Failed downloading artist art for \"{0}\": {1}", mv.Artist, url);
                return(null);
            }

            return(newArtistart);
        }
示例#7
0
        public static BasicArt FromUrl(DBBasicInfo mv, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (mvs == null)
            {
                mvs = mv;
            }
            if (!ignoreRestrictions)
            {
                minSize = new ImageSize();
                if (mvs.GetType() == typeof(DBTrackInfo))
                {
                    minSize.Width  = mvCentralCore.Settings.MinimumTrackWidth;
                    minSize.Height = mvCentralCore.Settings.MinimumTrackHeight;
                }
                if (mvs.GetType() == typeof(DBAlbumInfo))
                {
                    minSize.Width  = mvCentralCore.Settings.MinimumAlbumWidth;
                    minSize.Height = mvCentralCore.Settings.MinimumAlbumHeight;
                }
                if (mvs.GetType() == typeof(DBArtistInfo))
                {
                    minSize.Width  = mvCentralCore.Settings.MinimumArtistWidth;
                    minSize.Height = mvCentralCore.Settings.MinimumArtistHeight;
                }
            }

            bool redownload = false;

            if (mvs.GetType() == typeof(DBTrackInfo))
            {
                maxSize.Width  = mvCentralCore.Settings.MaximumTrackWidth;
                maxSize.Height = mvCentralCore.Settings.MaximumTrackHeight;
                redownload     = mvCentralCore.Settings.RedownloadTrackArtwork;
            }
            if (mvs.GetType() == typeof(DBAlbumInfo))
            {
                maxSize.Width  = mvCentralCore.Settings.MaximumAlbumWidth;
                maxSize.Height = mvCentralCore.Settings.MaximumAlbumHeight;
                redownload     = mvCentralCore.Settings.RedownloadAlbumArtwork;
            }
            if (mvs.GetType() == typeof(DBArtistInfo))
            {
                maxSize.Width  = mvCentralCore.Settings.MaximumArtistWidth;
                maxSize.Height = mvCentralCore.Settings.MaximumArtistHeight;
                redownload     = mvCentralCore.Settings.RedownloadArtistArtwork;
            }

            BasicArt newTrack = new BasicArt(mv);

            newTrack.Filename = GenerateFilename(url);
            status            = newTrack.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status)
            {
            case ImageLoadResults.SUCCESS:
                logger.Info("Added art for \"{0}\" from: {1}", mv.Basic, url);
                break;

            case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                logger.Info("Added resized art for \"{0}\" from: {1}", mv.Basic, url);
                break;

            case ImageLoadResults.FAILED_ALREADY_LOADED:
                logger.Debug("Art for \"{0}\" from the following URL is already loaded: {1}", mv.Basic, url);
                return(null);

            case ImageLoadResults.FAILED_TOO_SMALL:
                logger.Debug("Downloaded art for \"{0}\" failed minimum resolution requirements: {1}", mv.Basic, url);
                return(null);

            case ImageLoadResults.FAILED:
                logger.Error("Failed downloading art for \"{0}\": {1}", mv.Basic, url);
                return(null);
            }

            return(newTrack);
        }
示例#8
0
 public static BasicArt FromUrl(string title, string url, out ImageLoadResults status)
 {
     return(FromUrl(mvs, url, false, out status));
 }
示例#9
0
 public static ArtistArt FromUrl(DBArtistInfo mv, string url, out ImageLoadResults status)
 {
     return FromUrl(mv, url, false, out status);
 }
示例#10
0
        public static BasicArt FromFile(DBBasicInfo mv, string path, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();
            if (mvs == null) mvs = mv;
            if (!ignoreRestrictions)
            {
                minSize = new ImageSize();
                if (mvs.GetType() == typeof(DBTrackInfo))
                {
                    minSize.Width = mvCentralCore.Settings.MinimumTrackWidth;
                    minSize.Height = mvCentralCore.Settings.MinimumTrackHeight;
                }
                if (mvs.GetType() == typeof(DBAlbumInfo))
                {
                    minSize.Width = mvCentralCore.Settings.MinimumAlbumWidth;
                    minSize.Height = mvCentralCore.Settings.MinimumAlbumHeight;
                }
                if (mvs.GetType() == typeof(DBArtistInfo))
                {
                    minSize.Width = mvCentralCore.Settings.MinimumArtistWidth;
                    minSize.Height = mvCentralCore.Settings.MinimumArtistHeight;
                }
            }

            bool redownload = false;
            if (mvs.GetType() == typeof(DBTrackInfo))
            {
                maxSize.Width = mvCentralCore.Settings.MaximumTrackWidth;
                maxSize.Height = mvCentralCore.Settings.MaximumTrackHeight;
                redownload = mvCentralCore.Settings.RedownloadTrackArtwork;
            }
            if (mvs.GetType() == typeof(DBAlbumInfo))
            {
                maxSize.Width = mvCentralCore.Settings.MaximumAlbumWidth;
                maxSize.Height = mvCentralCore.Settings.MaximumAlbumHeight;
                redownload = mvCentralCore.Settings.RedownloadAlbumArtwork;
            }
            if (mvs.GetType() == typeof(DBArtistInfo))
            {
                maxSize.Width = mvCentralCore.Settings.MaximumArtistWidth;
                maxSize.Height = mvCentralCore.Settings.MaximumArtistHeight;
                redownload = mvCentralCore.Settings.RedownloadArtistArtwork;
            }

            BasicArt newTrack = new BasicArt(mv);
            newTrack.Filename = GenerateFilename(path);
            status = newTrack.FromFile(path, ignoreRestrictions, minSize, maxSize, redownload);

            string threadID = Thread.CurrentThread.ManagedThreadId.ToString();

            switch (status)
            {
                case ImageLoadResults.SUCCESS:
                    logger.Info("Added art for \"{0}\" from: {1}", mv.Basic, path);
                    break;
                case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                    logger.Info("Added resized art for \"{1}\" from: {2}", mv.Basic, path);
                    break;
                case ImageLoadResults.FAILED_ALREADY_LOADED:
                    logger.Debug("art for \"{0}\" from the following path is already loaded: {1}", mv.Basic, path);
                    return null;
                case ImageLoadResults.FAILED_TOO_SMALL:
                    logger.Debug("Downloaded art for \"{0}\" failed minimum resolution requirements: {1}", mv.Basic, path);
                    return null;
                case ImageLoadResults.FAILED:
                    logger.Error("(Failed art for \"{0}\": {1}", mv.Basic, path);
                    return null;
            }

            return newTrack;
        }
示例#11
0
 public static BasicArt FromFile(string title, string path, bool ignoreRestrictions, out ImageLoadResults status)
 {
     return FromFile(mvs, path, ignoreRestrictions, out status);
 }
示例#12
0
 public static BasicArt FromFile(string title, string path, out ImageLoadResults status)
 {
     return FromFile(mvs, path, false, out status);
 }
示例#13
0
 public static BasicArt FromFile(DBBasicInfo mv, string path, out ImageLoadResults status)
 {
     return FromFile(mv, path, false, out status);
 }
示例#14
0
 public static BasicArt FromUrl(string title, string url, bool ignoreRestrictions, out ImageLoadResults status)
 {
     return FromUrl(mvs, url, ignoreRestrictions, out status);
 }
示例#15
0
 public static BasicArt FromFile(string title, string path, out ImageLoadResults status)
 {
     return(FromFile(mvs, path, false, out status));
 }
示例#16
0
 public static BasicArt FromFile(string title, string path, bool ignoreRestrictions, out ImageLoadResults status)
 {
     return(FromFile(mvs, path, ignoreRestrictions, out status));
 }
示例#17
0
 public static ArtistArt FromUrl(string title, string url, out ImageLoadResults status)
 {
     DBArtistInfo mv = new DBArtistInfo();
     mv.Artist = title;
     return FromUrl(mv, url, false, out status);
 }
示例#18
0
 public static BasicArt FromUrl(string title, string url, bool ignoreRestrictions, out ImageLoadResults status)
 {
     return(FromUrl(mvs, url, ignoreRestrictions, out status));
 }
示例#19
0
 public static ArtistArt FromUrl(string title, string url, bool ignoreRestrictions, out ImageLoadResults status)
 {
     DBArtistInfo mv = new DBArtistInfo();
     mv.Artist = title;
     return FromUrl(mv, url, ignoreRestrictions, out status);
 }
示例#20
0
 public static ArtistArt FromUrl(DBArtistInfo mv, string url, out ImageLoadResults status)
 {
     return(FromUrl(mv, url, false, out status));
 }
示例#21
0
 public static Backdrop FromUrl(DBMovieInfo movie, string url, out ImageLoadResults status)
 {
     return(FromUrl(movie, url, false, out status));
 }
示例#22
0
        public static ArtistArt FromUrl(string title, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            DBArtistInfo mv = new DBArtistInfo();

            mv.Artist = title;
            return(FromUrl(mv, url, ignoreRestrictions, out status));
        }
示例#23
0
        public static Backdrop FromUrl(DBMovieInfo movie, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (!ignoreRestrictions)
            {
                minSize        = new ImageSize();
                minSize.Width  = MovingPicturesCore.Settings.MinimumBackdropWidth;
                minSize.Height = MovingPicturesCore.Settings.MinimumBackdropHeight;
            }

            maxSize.Width  = MovingPicturesCore.Settings.MaximumBackdropWidth;
            maxSize.Height = MovingPicturesCore.Settings.MaximumBackdropHeight;

            bool redownload = MovingPicturesCore.Settings.RedownloadBackdrops;

            Backdrop newBackdrop = new Backdrop();

            newBackdrop.Filename = GenerateFilename(movie, url);
            status = newBackdrop.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status)
            {
            case ImageLoadResults.SUCCESS:
                logger.Info("Added backdrop for \"{0}\" from: {1}", movie.Title, url);
                break;

            case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                logger.Info("Added resized backdrop for \"{0}\" from: {1}", movie.Title, url);
                break;

            case ImageLoadResults.FAILED_ALREADY_LOADED:
                logger.Debug("Backdrop for \"{0}\" from the following URL is already loaded: {1}", movie.Title, url);
                return(null);

            case ImageLoadResults.FAILED_TOO_SMALL:
                logger.Debug("Downloaded backdrop for \"{0}\" failed minimum resolution requirements: {1}", movie.Title, url);
                return(null);

            case ImageLoadResults.FAILED:
                logger.Error("Failed downloading backdrop for \"{0}\": {1}", movie.Title, url);
                return(null);
            }

            return(newBackdrop);
        }
示例#24
0
 public static Backdrop FromUrl(DBMovieInfo movie, string url, out ImageLoadResults status)
 {
     return FromUrl(movie, url, false, out status);
 }
示例#25
0
        /// <summary>
        /// Get the Album Art
        /// </summary>
        /// <param name="mv"></param>
        /// <returns></returns>
        public bool GetAlbumArt(DBAlbumInfo mvAlbumObject)
        {
            Logger.Debug("In Method : GetAlbumArt(DBAlbumInfo mv)");

            if (mvAlbumObject == null)
            {
                return(false);
            }

            List <string> albumImageList = mvAlbumObject.ArtUrls;

            // Reload existing Artwork - Why springs to mind??
            if (albumImageList.Count > 0)
            {
                // grab album art loading settings
                int maxAlbumArt = mvCentralCore.Settings.MaxAlbumArts;

                int albumartAdded = 0;
                int count         = 0;
                foreach (string albumImage in albumImageList)
                {
                    if (mvAlbumObject.AlternateArts.Count >= maxAlbumArt)
                    {
                        break;
                    }

                    if (mvAlbumObject.AddArtFromURL(albumImage) == ImageLoadResults.SUCCESS)
                    {
                        albumartAdded++;
                    }

                    count++;
                }
                // We added some artwork so commit
                if (count > 0)
                {
                    mvAlbumObject.Commit();
                }
            }

            // Now add any new art from this provider
            string             strAlbumHTML;
            DBArtistInfo       artist        = null;
            List <DBTrackInfo> tracksOnAlbum = DBTrackInfo.GetEntriesByAlbum(mvAlbumObject);

            if (tracksOnAlbum.Count > 0)
            {
                artist = DBArtistInfo.Get(tracksOnAlbum[0]);

                if (GetAlbumHTML(artist.Artist, mvAlbumObject.Album, out strAlbumHTML))
                {
                    var albumInfo = new MusicAlbumInfo();

                    if (albumInfo.Parse(strAlbumHTML))
                    {
                        ImageLoadResults imageLoadResults = mvAlbumObject.AddArtFromURL(albumInfo.ImageURL);

                        if (imageLoadResults == ImageLoadResults.SUCCESS || imageLoadResults == ImageLoadResults.SUCCESS_REDUCED_SIZE)
                        {
                            mvAlbumObject.Commit();
                        }
                    }
                }
            }
            // We always return sucess...
            return(true);
        }
示例#26
0
        protected ImageLoadResults VerifyAndResize(ImageSize minSize, ImageSize maxSize)
        {
            Image img      = null;
            Image newImage = null;

            try {
                ImageLoadResults rtn = ImageLoadResults.SUCCESS;

                // try to open the image
                img = Image.FromFile(Filename);
                int newWidth  = img.Width;
                int newHeight = img.Height;

                // check if the image is too small
                if (minSize != null)
                {
                    if (img.Width < minSize.Width || img.Height < minSize.Height)
                    {
                        img.Dispose();
                        img = null;
                        DeleteFile(Filename);
                        return(ImageLoadResults.FAILED_TOO_SMALL);
                    }
                }

                // check if the image is too big
                if (maxSize != null)
                {
                    if (img.Width > maxSize.Width || img.Height > maxSize.Height)
                    {
                        // calculate new dimensions
                        newWidth  = maxSize.Width;
                        newHeight = maxSize.Width * img.Height / img.Width;

                        if (newHeight > maxSize.Height)
                        {
                            newWidth  = maxSize.Height * img.Width / img.Height;
                            newHeight = maxSize.Height;
                        }

                        rtn = ImageLoadResults.SUCCESS_REDUCED_SIZE;
                    }
                }

                // resize / rebuild image
                newImage = (Image) new Bitmap(newWidth, newHeight);
                Graphics g = Graphics.FromImage((Image)newImage);
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.DrawImage(img, 0, 0, newWidth, newHeight);
                g.Dispose();
                img.Dispose();
                img = null;

                // determine compression quality
                int quality = MovingPicturesCore.Settings.JpgCompressionQuality;
                if (quality > 100)
                {
                    quality = 100;
                }
                if (quality < 0)
                {
                    quality = 0;
                }

                // save image as a jpg
                ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);
                System.Drawing.Imaging.Encoder qualityParamID = System.Drawing.Imaging.Encoder.Quality;
                EncoderParameter  qualityParam  = new EncoderParameter(qualityParamID, quality);
                EncoderParameters encoderParams = new EncoderParameters(1);
                encoderParams.Param[0] = qualityParam;
                newImage.Save(Filename, jgpEncoder, encoderParams);
                newImage.Dispose();
                newImage = null;

                return(rtn);
            }
            catch (Exception e) {
                logger.Error("An error occured while processing '{0}': {1}", Filename, e.Message);

                // even though we already have this disposing logic in the finally statement we
                // make sure the objects are disposed before File.Delete is called.
                if (img != null)
                {
                    img.Dispose();
                    img = null;
                }

                if (newImage != null)
                {
                    newImage.Dispose();
                    newImage = null;
                }

                DeleteFile(Filename);

                return(ImageLoadResults.FAILED);
            }
            finally {
                if (img != null)
                {
                    img.Dispose();
                }
                if (newImage != null)
                {
                    newImage.Dispose();
                }
            }
        }
示例#27
0
        protected ImageLoadResults VerifyAndResize(ImageSize minSize, ImageSize maxSize)
        {
            //logger.Debug("Using Min W {0} H {1}", minSize.Width, minSize.Height);

            Image img = null;

            try
            {
                ImageLoadResults rtn = ImageLoadResults.SUCCESS;

                // try to open the image
                img = Image.FromFile(Filename);
                int newWidth  = img.Width;
                int newHeight = img.Height;

                //logger.Debug("Filename {0} has W {1} H {2}", Filename, newWidth, newHeight);

                // check if the image is too small
                if (minSize != null)
                {
                    if (img.Width < minSize.Width || img.Height < minSize.Height)
                    {
                        img.Dispose();
                        img = null;
                        if (File.Exists(Filename))
                        {
                            File.Delete(Filename);
                        }
                        return(ImageLoadResults.FAILED_TOO_SMALL);
                    }
                }

                // check if the image is too big
                if (maxSize != null)
                {
                    if (img.Width > maxSize.Width || img.Height > maxSize.Height)
                    {
                        // calculate new dimensions
                        newWidth  = maxSize.Width;
                        newHeight = maxSize.Width * img.Height / img.Width;

                        if (newHeight > maxSize.Height)
                        {
                            newWidth  = maxSize.Height * img.Width / img.Height;
                            newHeight = maxSize.Height;
                        }

                        rtn = ImageLoadResults.SUCCESS_REDUCED_SIZE;
                    }
                }

                // resize / rebuild image
                Image    newImage = (Image) new Bitmap(newWidth, newHeight);
                Graphics g        = Graphics.FromImage((Image)newImage);
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.DrawImage(img, 0, 0, newWidth, newHeight);
                g.Dispose();
                img.Dispose();
                img = null;

                // determine compression quality
                int quality = mvCentralCore.Settings.JpgCompressionQuality;
                if (quality > 100)
                {
                    quality = 100;
                }
                if (quality < 0)
                {
                    quality = 0;
                }

                // save image as a jpg
                ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);
                System.Drawing.Imaging.Encoder qualityParamID = System.Drawing.Imaging.Encoder.Quality;
                EncoderParameter  qualityParam  = new EncoderParameter(qualityParamID, quality);
                EncoderParameters encoderParams = new EncoderParameters(1);
                encoderParams.Param[0] = qualityParam;
                newImage.Save(Filename, jgpEncoder, encoderParams);
                newImage.Dispose();

                return(rtn);
            }
            catch (Exception e)
            {
                logger.DebugException("Exception in VerifyAndResize : ", e);

                if (File.Exists(Filename))
                {
                    File.Delete(Filename);
                }
                return(ImageLoadResults.FAILED);
            }
            finally
            {
                if (img != null)
                {
                    img.Dispose();
                }
            }
        }