Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump SixLabors.ImageSharp from 2.1.7 to 3.1.4 #112

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<ItemGroup Condition="$(MSBuildProjectName.StartsWith('MilkiBotFramework')) == 'true'">
<PackageReference Include="MinVer" Version="4.3.0">
<PackageReference Include="MinVer" Version="5.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/MilkiBotFramework.Imaging.Wpf/WpfDrawingProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ await Application.Current.Dispatcher.InvokeAsync(async () =>

try
{
return await Image.LoadAsync(retStream, new PngDecoder());
return await PngDecoder.Instance.DecodeAsync(new PngDecoderOptions(), retStream);
}
finally
{
Expand Down
31 changes: 12 additions & 19 deletions src/MilkiBotFramework/Imaging/ImageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static Image GetResizedImage(Image source, float uniformScaleRate)

public static Image GetRotatedImage(Image source, float angle, bool crop = false, Size resize = default)
{
if (resize == Size.Empty) resize = source.Size();
if (resize == Size.Empty) resize = source.Size;

var returnBitmap = source
.Clone(k => k
Expand Down Expand Up @@ -169,7 +169,7 @@ public static Image GetRotatedImage(Image source, float angle, bool crop = false

public static Image GetTranslatedBitmap(Image source, int x, int y, Size resize = default)
{
if (resize == Size.Empty) resize = source.Size();
if (resize == Size.Empty) resize = source.Size;
var returnBitmap = source
.Clone(k => k
.AutoOrient()
Expand All @@ -191,25 +191,18 @@ public static async Task SaveGifToFileAsync(string path, Image gif, Color[]? pal
gif.Mutate(k => k.Quantize());
var encoder = new GifEncoder
{
ColorTableMode = GifColorTableMode.Global,
GlobalPixelSamplingStrategy = new ExtensivePixelSamplingStrategy(),
Quantizer = new OctreeQuantizer(new QuantizerOptions
{
DitherScale = QuantizerConstants.MinDitherScale,
})
};

if (palettes != null)
{
encoder.ColorTableMode = GifColorTableMode.Local;
encoder.Quantizer = new PaletteQuantizer(new ReadOnlyMemory<Color>(palettes),
new QuantizerOptions
ColorTableMode = palettes == null ? GifColorTableMode.Global : GifColorTableMode.Local,
PixelSamplingStrategy = new ExtensivePixelSamplingStrategy(),
Quantizer = palettes == null
? new OctreeQuantizer(new QuantizerOptions
{
DitherScale = QuantizerConstants.MinDitherScale
}
);
}

})
: new PaletteQuantizer(new ReadOnlyMemory<Color>(palettes), new QuantizerOptions
{
DitherScale = QuantizerConstants.MinDitherScale
})
};
await gif.SaveAsGifAsync(path, encoder);
}

Expand Down
2 changes: 1 addition & 1 deletion src/MilkiBotFramework/MilkiBotFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<!-- ReSharper disable once VulnerablePackage -->
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.7" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="Websocket.Client" Version="5.1.1" />
<PackageReference Include="YamlDotNet" Version="15.1.2" />
</ItemGroup>
Expand Down
Loading