Browse Source

Merge branch 'master' into js/fix-260

af/merge-core
James Jackson-South 8 years ago
committed by GitHub
parent
commit
3ca887375e
  1. 25
      src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs
  2. 1
      src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs
  3. 1
      src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs
  4. 2
      src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs
  5. 1
      src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs

25
src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Helpers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
@ -87,6 +88,30 @@ namespace SixLabors.ImageSharp.Processing.Processors
}
}
/// <inheritdoc/>
protected override void AfterImageApply(Image<TPixel> source, Rectangle sourceRectangle)
{
ExifProfile profile = source.MetaData.ExifProfile;
if (profile == null)
{
return;
}
if (MathF.Abs(this.Angle) < Constants.Epsilon)
{
// No need to do anything so return.
return;
}
profile.RemoveValue(ExifTag.Orientation);
if (this.Expand && profile.GetValue(ExifTag.PixelXDimension) != null)
{
profile.SetValue(ExifTag.PixelXDimension, source.Width);
profile.SetValue(ExifTag.PixelYDimension, source.Height);
}
}
/// <summary>
/// Rotates the images with an optimized method when the angle is 90, 180 or 270 degrees.
/// </summary>

1
src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs

@ -61,6 +61,7 @@ namespace SixLabors.ImageSharp.Quantizers
this.colors = (byte)maxColors.Clamp(1, 255);
this.octree = new Octree(this.GetBitsNeededForColorDepth(this.colors));
this.palette = null;
this.colorMap.Clear();
return base.Quantize(image, this.colors);
}

1
src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs

@ -58,6 +58,7 @@ namespace SixLabors.ImageSharp.Quantizers
public override QuantizedImage<TPixel> Quantize(ImageFrame<TPixel> image, int maxColors)
{
Array.Resize(ref this.colors, maxColors.Clamp(1, 255));
this.colorMap.Clear();
return base.Quantize(image, maxColors);
}

2
src/ImageSharp/Quantizers/QuantizerBase{TPixel}.cs

@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Quantizers.Base
public bool Dither { get; set; } = true;
/// <inheritdoc />
public IErrorDiffuser DitherType { get; set; } = new SierraLiteDiffuser();
public IErrorDiffuser DitherType { get; set; } = new FloydSteinbergDiffuser();
/// <inheritdoc/>
public virtual QuantizedImage<TPixel> Quantize(ImageFrame<TPixel> image, int maxColors)

1
src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs

@ -139,6 +139,7 @@ namespace SixLabors.ImageSharp.Quantizers
this.colors = maxColors.Clamp(1, 255);
this.palette = null;
this.colorMap.Clear();
try
{

Loading…
Cancel
Save