Skip to content
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
build:
runs-on: windows-latest
runs-on: windows-2022
steps:
- uses: actions/checkout@v6

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

build-desktop:
needs: validate
runs-on: windows-latest
runs-on: windows-2022
permissions:
contents: read

Expand Down
6 changes: 6 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup Condition="'$(GenerateDocumentationFile)'=='true'">
<!-- XML docs are generated for release packages, but not every public API is documented yet. -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
</Project>
17 changes: 16 additions & 1 deletion OpenSourceToolkit.Converters/ImageConverter.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
using System;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.Versioning;

namespace OpenSourceToolkit.Converters
{
/// <summary>
/// Provides basic image conversion helpers for file and byte-array inputs.
/// </summary>
[SupportedOSPlatform("windows")]
public static class ImageConverter
{
/// <summary>
/// Converts an image file to the specified output format.
/// </summary>
/// <param name="inputPath">Path to the source image file.</param>
/// <param name="outputPath">Path where the converted image should be saved.</param>
/// <param name="format">Image format to use for the output file.</param>
public static void Convert(string inputPath, string outputPath, ImageFormat format)
{
using (var image = Image.FromFile(inputPath))
Expand All @@ -17,6 +26,12 @@ public static void Convert(string inputPath, string outputPath, ImageFormat form
}
}

/// <summary>
/// Converts image bytes to the specified output format.
/// </summary>
/// <param name="inputBytes">Source image bytes.</param>
/// <param name="format">Image format to use for the converted bytes.</param>
/// <returns>The converted image bytes.</returns>
public static byte[] Convert(byte[] inputBytes, ImageFormat format)
{
using (var inputStream = new MemoryStream(inputBytes))
Expand Down
Loading