Repository navigation
Support JP2 images as conversion sources - #28
Conversation
Co-authored-by: pg94au <5140674+pg94au@users.noreply.github.com>
|
@copilot Need to redo this because a change from ImageSharp to Magick.NET was made. |
I checked the current branch: |
|
@copilot If you look at the main branch, the application was converted to use only Magick.NET because of a security vulnerability in ImageSharp. If you merge main into this branch, you'll see that ImageSharp is no longer used. So please rework this change to support jp2 based on what is currently in main. |
…rt-conversion # Conflicts: # ImageConverter.Tests/ImageConverter.Tests.csproj # ImageConverter/Converter.cs # ImageConverter/ImageConverter.csproj # ImageConverter/packages.config Co-authored-by: pg94au <5140674+pg94au@users.noreply.github.com>
Merged |
There was a problem hiding this comment.
🟡 Changes recommended
The JP2 path still uses Magick.NET for output encoding instead of the required ImageSharp handoff, which must be implemented while preserving JPG quality and PNG compression settings.
1 open issue
What changed in this PR
This PR exposes JP2 as a source format in Convertster’s Explorer integration and adds conversion coverage, while keeping JPG and PNG as the supported outputs.
Changes:
- Add
.jp2to the Explorer source allowlist and README. - Generate JP2 test images and add JPG/PNG conversion cases.
- Add explicit Magick.NET references to the test project and reorder existing package entries.
| File | Description |
|---|---|
| ShellExtContextMenuHandler/FileContextMenuExt.cpp | Allow JP2 source files in Explorer. |
| README.md | List JP2 among supported source formats. |
| ImageConverter.Tests/TestSupport.cs | Generate JP2 test images using Magick.NET. |
| ImageConverter.Tests/packages.config | Reorder existing Magick.NET package entries. |
| ImageConverter.Tests/ImageConverter.Tests.csproj | Add Magick.NET assembly references. |
| ImageConverter.Tests/ImageConversionTests.cs | Add JP2-to-JPG and JP2-to-PNG integration cases. |
| ImageConverter.Tests/ConverterTests.cs | Add JP2 cases to converter tests. |
Review effort: Balanced
| const wchar_t* dot = wcsrchr(file->c_str(), L'.'); | ||
| // Allowed extensions (case-insensitive). | ||
| const wchar_t* allowedExts[] = { L".bmp", L".png", L".tif", L".tiff", L".webp" }; | ||
| const wchar_t* allowedExts[] = { L".bmp", L".jp2", L".png", L".tif", L".tiff", L".webp" }; |

Convertster should accept JP2 files as source images while keeping JP2 unsupported as an output format. Existing JPG and PNG conversion settings should remain unchanged.
.jp2inputs, then pass the decoded image to ImageSharp for output encoding.