Skip to content

Commit a65d290

Browse files
committed
Merge remote-tracking branch 'origin/main' into bp/tiff-jpeg-cmyk
# Conflicts: # src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs
2 parents bf97398 + 5c28129 commit a65d290

File tree

1,360 files changed

+33036
-32939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,360 files changed

+33036
-32939
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ dotnet_diagnostic.IDE0063.severity = suggestion
172172
csharp_using_directive_placement = outside_namespace:warning
173173
# Modifier preferences
174174
csharp_prefer_static_local_function = true:warning
175+
# Primary constructor preferences
176+
csharp_style_prefer_primary_constructors = false:none
175177

176178
##########################################
177179
# Unnecessary Code Rules

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@
133133
*.pnm filter=lfs diff=lfs merge=lfs -text
134134
*.wbmp filter=lfs diff=lfs merge=lfs -text
135135
*.exr filter=lfs diff=lfs merge=lfs -text
136+
*.ico filter=lfs diff=lfs merge=lfs -text
137+
*.cur filter=lfs diff=lfs merge=lfs -text
138+
*.ani filter=lfs diff=lfs merge=lfs -text

.github/workflows/build-and-test.yml

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- release/*
78
tags:
89
- "v*"
910
pull_request:
@@ -19,42 +20,23 @@ jobs:
1920
- ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }}
2021
options:
2122
- os: ubuntu-latest
22-
framework: net7.0
23-
sdk: 7.0.x
24-
sdk-preview: true
23+
framework: net8.0
24+
sdk: 8.0.x
2525
runtime: -x64
2626
codecov: false
27-
- os: macos-latest
28-
framework: net7.0
29-
sdk: 7.0.x
30-
sdk-preview: true
27+
- os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable
28+
framework: net8.0
29+
sdk: 8.0.x
3130
runtime: -x64
3231
codecov: false
3332
- os: windows-latest
34-
framework: net7.0
35-
sdk: 7.0.x
36-
sdk-preview: true
33+
framework: net8.0
34+
sdk: 8.0.x
3735
runtime: -x64
3836
codecov: false
3937
- os: buildjet-4vcpu-ubuntu-2204-arm
40-
framework: net7.0
41-
sdk: 7.0.x
42-
sdk-preview: true
43-
runtime: -x64
44-
codecov: false
45-
- os: ubuntu-latest
46-
framework: net6.0
47-
sdk: 6.0.x
48-
runtime: -x64
49-
codecov: false
50-
- os: macos-latest
51-
framework: net6.0
52-
sdk: 6.0.x
53-
runtime: -x64
54-
codecov: false
55-
- os: windows-latest
56-
framework: net6.0
57-
sdk: 6.0.x
38+
framework: net8.0
39+
sdk: 8.0.x
5840
runtime: -x64
5941
codecov: false
6042
exclude:
@@ -86,7 +68,7 @@ jobs:
8668
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
8769

8870
- name: Git Setup LFS Cache
89-
uses: actions/cache@v3
71+
uses: actions/cache@v4
9072
id: lfs-cache
9173
with:
9274
path: .git/lfs
@@ -96,10 +78,10 @@ jobs:
9678
run: git lfs pull
9779

9880
- name: NuGet Install
99-
uses: NuGet/setup-nuget@v1
81+
uses: NuGet/setup-nuget@v2
10082

10183
- name: NuGet Setup Cache
102-
uses: actions/cache@v3
84+
uses: actions/cache@v4
10385
id: nuget-cache
10486
with:
10587
path: ~/.nuget
@@ -108,17 +90,17 @@ jobs:
10890

10991
- name: DotNet Setup
11092
if: ${{ matrix.options.sdk-preview != true }}
111-
uses: actions/setup-dotnet@v3
93+
uses: actions/setup-dotnet@v4
11294
with:
11395
dotnet-version: |
114-
6.0.x
96+
8.0.x
11597
11698
- name: DotNet Setup Preview
11799
if: ${{ matrix.options.sdk-preview == true }}
118-
uses: actions/setup-dotnet@v3
100+
uses: actions/setup-dotnet@v4
119101
with:
120102
dotnet-version: |
121-
7.0.x
103+
8.0.x
122104
123105
- name: DotNet Build
124106
if: ${{ matrix.options.sdk-preview != true }}
@@ -151,7 +133,7 @@ jobs:
151133
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
152134

153135
- name: Export Failed Output
154-
uses: actions/upload-artifact@v3
136+
uses: actions/upload-artifact@v4
155137
if: failure()
156138
with:
157139
name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
@@ -178,10 +160,10 @@ jobs:
178160
submodules: recursive
179161

180162
- name: NuGet Install
181-
uses: NuGet/setup-nuget@v1
163+
uses: NuGet/setup-nuget@v2
182164

183165
- name: NuGet Setup Cache
184-
uses: actions/cache@v3
166+
uses: actions/cache@v4
185167
id: nuget-cache
186168
with:
187169
path: ~/.nuget

.github/workflows/code-coverage.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
matrix:
1111
options:
1212
- os: ubuntu-latest
13-
framework: net6.0
13+
framework: net8.0
1414
runtime: -x64
1515
codecov: true
1616

@@ -34,7 +34,7 @@ jobs:
3434
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
3535

3636
- name: Git Setup LFS Cache
37-
uses: actions/cache@v3
37+
uses: actions/cache@v4
3838
id: lfs-cache
3939
with:
4040
path: .git/lfs
@@ -44,21 +44,21 @@ jobs:
4444
run: git lfs pull
4545

4646
- name: NuGet Install
47-
uses: NuGet/setup-nuget@v1
47+
uses: NuGet/setup-nuget@v2
4848

4949
- name: NuGet Setup Cache
50-
uses: actions/cache@v3
50+
uses: actions/cache@v4
5151
id: nuget-cache
5252
with:
5353
path: ~/.nuget
5454
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
5555
restore-keys: ${{ runner.os }}-nuget-
5656

5757
- name: DotNet Setup
58-
uses: actions/setup-dotnet@v3
58+
uses: actions/setup-dotnet@v4
5959
with:
6060
dotnet-version: |
61-
6.0.x
61+
8.0.x
6262
6363
- name: DotNet Build
6464
shell: pwsh
@@ -74,14 +74,14 @@ jobs:
7474
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
7575

7676
- name: Export Failed Output
77-
uses: actions/upload-artifact@v3
77+
uses: actions/upload-artifact@v4
7878
if: failure()
7979
with:
8080
name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
8181
path: tests/Images/ActualOutput/
8282

8383
- name: Codecov Update
84-
uses: codecov/codecov-action@v3
84+
uses: codecov/codecov-action@v4
8585
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
8686
with:
8787
flags: unittests

ImageSharp.sln

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{815C0625-CD3
3838
src\Directory.Build.props = src\Directory.Build.props
3939
src\Directory.Build.targets = src\Directory.Build.targets
4040
src\README.md = src\README.md
41+
src\ImageSharp.ruleset = src\ImageSharp.ruleset
4142
EndProjectSection
4243
EndProject
4344
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp", "src\ImageSharp\ImageSharp.csproj", "{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}"
@@ -237,6 +238,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "issues", "issues", "{5C9B68
237238
tests\Images\Input\Jpg\issues\issue750-exif-tranform.jpg = tests\Images\Input\Jpg\issues\issue750-exif-tranform.jpg
238239
tests\Images\Input\Jpg\issues\Issue845-Incorrect-Quality99.jpg = tests\Images\Input\Jpg\issues\Issue845-Incorrect-Quality99.jpg
239240
tests\Images\Input\Jpg\issues\issue855-incorrect-colorspace.jpg = tests\Images\Input\Jpg\issues\issue855-incorrect-colorspace.jpg
241+
tests\Images\Input\Jpg\issues\issue-2067-comment.jpg = tests\Images\Input\Jpg\issues\issue-2067-comment.jpg
240242
EndProjectSection
241243
EndProject
242244
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fuzz", "fuzz", "{516A3532-6AC2-417B-AD79-9BD5D0D378A0}"
@@ -659,6 +661,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Qoi", "Qoi", "{E801B508-493
659661
tests\Images\Input\Qoi\wikipedia_008.qoi = tests\Images\Input\Qoi\wikipedia_008.qoi
660662
EndProjectSection
661663
EndProject
664+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Icon", "Icon", "{95E45DDE-A67D-48AD-BBA8-5FAA151B860D}"
665+
ProjectSection(SolutionItems) = preProject
666+
tests\Images\Input\Icon\aero_arrow.cur = tests\Images\Input\Icon\aero_arrow.cur
667+
tests\Images\Input\Icon\flutter.ico = tests\Images\Input\Icon\flutter.ico
668+
EndProjectSection
669+
EndProject
662670
Global
663671
GlobalSection(SolutionConfigurationPlatforms) = preSolution
664672
Debug|Any CPU = Debug|Any CPU
@@ -712,6 +720,7 @@ Global
712720
{670DD46C-82E9-499A-B2D2-00A802ED0141} = {E1C42A6F-913B-4A7B-B1A8-2BB62843B254}
713721
{5DFC394F-136F-4B76-9BCA-3BA786515EFC} = {9DA226A1-8656-49A8-A58A-A8B5C081AD66}
714722
{E801B508-4935-41CD-BA85-CF11BFF55A45} = {9DA226A1-8656-49A8-A58A-A8B5C081AD66}
723+
{95E45DDE-A67D-48AD-BBA8-5FAA151B860D} = {9DA226A1-8656-49A8-A58A-A8B5C081AD66}
715724
EndGlobalSection
716725
GlobalSection(ExtensibilityGlobals) = postSolution
717726
SolutionGuid = {5F8B9D1F-CD8B-4CC5-8216-D531E25BD795}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Designed to simplify image processing, ImageSharp brings you an incredibly power
2121

2222
ImageSharp is designed from the ground up to be flexible and extensible. The library provides API endpoints for common image processing operations and the building blocks to allow for the development of additional operations.
2323

24-
Built against [.NET 6](https://docs.microsoft.com/en-us/dotnet/standard/net-standard), ImageSharp can be used in device, cloud, and embedded/IoT scenarios.
24+
Built against [.NET 8](https://docs.microsoft.com/en-us/dotnet/standard/net-standard), ImageSharp can be used in device, cloud, and embedded/IoT scenarios.
2525

2626

2727
## License
@@ -64,7 +64,7 @@ If you prefer, you can compile ImageSharp yourself (please do and help!)
6464

6565
- Using [Visual Studio 2022](https://visualstudio.microsoft.com/vs/)
6666
- Make sure you have the latest version installed
67-
- Make sure you have [the .NET 7 SDK](https://www.microsoft.com/net/core#windows) installed
67+
- Make sure you have [the .NET 8 SDK](https://www.microsoft.com/net/core#windows) installed
6868

6969
Alternatively, you can work from command line and/or with a lightweight editor on **both Linux/Unix and Windows**:
7070

src/ImageSharp.ruleset

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RuleSet Name="ImageSharp" ToolsVersion="17.0">
33
<Include Path="..\shared-infrastructure\sixlabors.ruleset" Action="Default" />
4-
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
5-
<Rule Id="SA1011" Action="None" />
6-
</Rules>
74
</RuleSet>

src/ImageSharp/Advanced/AdvancedImageExtensions.cs

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ public static IImageEncoder DetectEncoder(this Image source, string filePath)
2727
Guard.NotNull(filePath, nameof(filePath));
2828

2929
string ext = Path.GetExtension(filePath);
30-
if (!source.GetConfiguration().ImageFormatsManager.TryFindFormatByFileExtension(ext, out IImageFormat? format))
30+
if (!source.Configuration.ImageFormatsManager.TryFindFormatByFileExtension(ext, out IImageFormat? format))
3131
{
3232
StringBuilder sb = new();
3333
sb = sb.AppendLine(CultureInfo.InvariantCulture, $"No encoder was found for extension '{ext}'. Registered encoders include:");
34-
foreach (IImageFormat fmt in source.GetConfiguration().ImageFormats)
34+
foreach (IImageFormat fmt in source.Configuration.ImageFormats)
3535
{
3636
sb = sb.AppendFormat(CultureInfo.InvariantCulture, " - {0} : {1}{2}", fmt.Name, string.Join(", ", fmt.FileExtensions), Environment.NewLine);
3737
}
3838

3939
throw new UnknownImageFormatException(sb.ToString());
4040
}
4141

42-
IImageEncoder? encoder = source.GetConfiguration().ImageFormatsManager.GetEncoder(format);
42+
IImageEncoder? encoder = source.Configuration.ImageFormatsManager.GetEncoder(format);
4343

4444
if (encoder is null)
4545
{
4646
StringBuilder sb = new();
4747
sb = sb.AppendLine(CultureInfo.InvariantCulture, $"No encoder was found for extension '{ext}' using image format '{format.Name}'. Registered encoders include:");
48-
foreach (KeyValuePair<IImageFormat, IImageEncoder> enc in source.GetConfiguration().ImageFormatsManager.ImageEncoders)
48+
foreach (KeyValuePair<IImageFormat, IImageEncoder> enc in source.Configuration.ImageFormatsManager.ImageEncoders)
4949
{
5050
sb = sb.AppendFormat(CultureInfo.InvariantCulture, " - {0} : {1}{2}", enc.Key, enc.Value.GetType().Name, Environment.NewLine);
5151
}
@@ -76,30 +76,6 @@ public static void AcceptVisitor(this Image source, IImageVisitor visitor)
7676
public static Task AcceptVisitorAsync(this Image source, IImageVisitorAsync visitor, CancellationToken cancellationToken = default)
7777
=> source.AcceptAsync(visitor, cancellationToken);
7878

79-
/// <summary>
80-
/// Gets the configuration for the image.
81-
/// </summary>
82-
/// <param name="source">The source image.</param>
83-
/// <returns>Returns the configuration.</returns>
84-
public static Configuration GetConfiguration(this Image source)
85-
=> GetConfiguration((IConfigurationProvider)source);
86-
87-
/// <summary>
88-
/// Gets the configuration for the image frame.
89-
/// </summary>
90-
/// <param name="source">The source image.</param>
91-
/// <returns>Returns the configuration.</returns>
92-
public static Configuration GetConfiguration(this ImageFrame source)
93-
=> GetConfiguration((IConfigurationProvider)source);
94-
95-
/// <summary>
96-
/// Gets the configuration.
97-
/// </summary>
98-
/// <param name="source">The source image</param>
99-
/// <returns>Returns the bounds of the image</returns>
100-
private static Configuration GetConfiguration(IConfigurationProvider source)
101-
=> source?.Configuration ?? Configuration.Default;
102-
10379
/// <summary>
10480
/// Gets the representation of the pixels as a <see cref="IMemoryGroup{T}"/> containing the backing pixel data of the image
10581
/// stored in row major order, as a list of contiguous <see cref="Memory{T}"/> blocks in the source image's pixel format.
@@ -167,12 +143,4 @@ public static Memory<TPixel> DangerousGetPixelRowMemory<TPixel>(this Image<TPixe
167143

168144
return source.Frames.RootFrame.PixelBuffer.GetSafeRowMemory(rowIndex);
169145
}
170-
171-
/// <summary>
172-
/// Gets the <see cref="MemoryAllocator"/> assigned to 'source'.
173-
/// </summary>
174-
/// <param name="source">The source image.</param>
175-
/// <returns>Returns the configuration.</returns>
176-
internal static MemoryAllocator GetMemoryAllocator(this IConfigurationProvider source)
177-
=> GetConfiguration(source).MemoryAllocator;
178146
}

0 commit comments

Comments
 (0)