Beispiel #1
0
    void GenerateThumbnail(Ffmpeg ffmpeg, string localSourceFile, string localThumbnailFile, MovieMetadata mm)
    {
        ffmpeg.ExtractFrame(localSourceFile, localThumbnailFile, GetThumbnailSeconds(mm));

        using (var wand = new MagickWand(localThumbnailFile))
        {
            wand.GetLargestDimensionsKeepingAspectRatio(THUMB_WIDTH, THUMB_HEIGHT, out uint width, out uint height);
            wand.ScaleImage(width, height);

            // sharpen after potentially resizing
            // http://www.imagemagick.org/Usage/resize/#resize_unsharp
            wand.UnsharpMaskImage(0, 0.7, 0.7, 0.008);

            wand.WriteImage(localThumbnailFile, true);

            mm.ThumbHeight = (int)height;
            mm.ThumbWidth  = (int)width;
        }
    }