minor image colour tweaking

This commit is contained in:
Paddy Xu
2020-05-15 00:02:26 +03:00
parent 1cd5019706
commit 8faa152960
8 changed files with 66 additions and 24 deletions

View File

@@ -27,21 +27,21 @@ using System.Windows.Media.Imaging;
using LibAPNG;
using QuickLook.Common.ExtensionMethods;
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
{
internal class APngAnimationProvider : AnimationProvider
internal class APngProvider : AnimationProvider
{
private readonly Frame _baseFrame;
private readonly List<FrameInfo> _frames;
private readonly List<BitmapSource> _renderedFrames;
private int _lastEffectivePreviousPreviousFrameIndex;
private NativeImageProvider _nativeImageProvider;
private NativeProvider _nativeImageProvider;
public APngAnimationProvider(string path, MetaProvider meta) : base(path, meta)
public APngProvider(string path, MetaProvider meta) : base(path, meta)
{
if (!IsAnimatedPng(path))
{
_nativeImageProvider = new NativeImageProvider(path, meta);
_nativeImageProvider = new NativeProvider(path, meta);
Animator = _nativeImageProvider.Animator;
return;
}

View File

@@ -0,0 +1,29 @@
// Copyright © 2020 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
{
internal class DcrawProvider : NativeProvider
{
public DcrawProvider(string path, MetaProvider meta) : base(path, meta)
{
throw new NotImplementedException();
}
}
}

View File

@@ -24,15 +24,15 @@ using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using Size = System.Windows.Size;
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
{
internal class GifAnimationProvider : AnimationProvider
internal class GifProvider : AnimationProvider
{
private Bitmap _fileHandle;
private BitmapSource _frame;
private bool _isPlaying;
public GifAnimationProvider(string path, MetaProvider meta) : base(path, meta)
public GifProvider(string path, MetaProvider meta) : base(path, meta)
{
_fileHandle = (Bitmap) Image.FromFile(path);

View File

@@ -23,9 +23,10 @@ using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using ImageMagick;
using ImageMagick.Formats.Dng;
using QuickLook.Common.Helpers;
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
{
internal class ImageMagickProvider : AnimationProvider
{
@@ -80,9 +81,19 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
return new Task<BitmapSource>(() =>
{
var settings = new MagickReadSettings
{
Defines = new DngReadDefines
{
OutputColor = DngOutputColor.SRGB,
UseCameraWhitebalance = true,
DisableAutoBrightness = false
}
};
try
{
using (var mi = new MagickImage(Path))
using (var mi = new MagickImage(Path, settings))
{
var profile = mi.GetColorProfile();
if (profile?.Description != null && !profile.Description.Contains("sRGB"))

View File

@@ -23,11 +23,11 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using QuickLook.Common.Helpers;
namespace QuickLook.Plugin.ImageViewer.AnimatedImage
namespace QuickLook.Plugin.ImageViewer.AnimatedImage.Providers
{
internal class NativeImageProvider : AnimationProvider
internal class NativeProvider : AnimationProvider
{
public NativeImageProvider(string path, MetaProvider meta) : base(path, meta)
public NativeProvider(string path, MetaProvider meta) : base(path, meta)
{
Animator = new Int32AnimationUsingKeyFrames();
Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0,