Skip to content
Open
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
28 changes: 28 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 2.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
# - name: Test
# run: dotnet test --no-build --verbosity normal
13 changes: 9 additions & 4 deletions src/OpenJpegDotNet/IO/Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ public int Width

#region Methods

public bool ReadHeader()
/// <summary>
/// Reads the header of the image stream and initializes the decoder with the specified codec format.
/// </summary>
/// <param name="codecFormat">The codec format to use for decompression. Default is <see cref="CodecFormat.Jp2"/>.</param>
/// <returns><c>true</c> if the header was read successfully; otherwise, <c>false</c>.</returns>
public bool ReadHeader(CodecFormat codecFormat = CodecFormat.Jp2)
{
this._Codec?.Dispose();
this._DecompressionParameters?.Dispose();
Expand All @@ -99,9 +104,9 @@ public bool ReadHeader()
this._DecompressionParameters = null;
this._Image = null;

// ToDo: Support to change format?
this._Codec = OpenJpeg.CreateDecompress(CodecFormat.J2k);
//this._Codec = OpenJpeg.CreateDecompress(CodecFormat.Jp2);
// Set codec format
this._Codec = OpenJpeg.CreateDecompress(codecFormat);

this._DecompressionParameters = new DecompressionParameters();
OpenJpeg.SetDefaultDecoderParameters(this._DecompressionParameters);

Expand Down
9 changes: 1 addition & 8 deletions src/OpenJpegDotNet/OpenJpegDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.Contains('netstandard')) Or $(TargetFramework.Contains('netcoreapp')) ">
<PackageReference Include="System.Drawing.Common">
<Version>5.0.2</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
</ItemGroup>

<ItemGroup>
Expand All @@ -51,9 +49,4 @@
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion test/OpenJpegDotNet.Tests/OpenJpegDotNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>
Expand Down