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
DEBUG
RELEASE
3.0.1
?
Windows 11
As requested on Twitter: https://twitter.com/James_M_South/status/1673489691956625410
When compiling https://github.com/pjmlp/ppm2png/tree/2b77cfc103f48bbcdce0512f6182153d6d4d8644/csharp with PublishAot, the produced executable is rather large. The reason why it's large can be inspected with Sizoscope. I made this change to the above repo in an attempt to make the size smaller but it didn't help much:
diff --git a/csharp/ImageWriter.cs b/csharp/ImageWriter.cs index 89af11c..5b4b3eb 100644 --- a/csharp/ImageWriter.cs +++ b/csharp/ImageWriter.cs @@ -36,7 +36,7 @@ public static class ImageWriter /// <param name="height">The image height in pixels.</param> public static void SaveImage(string filename, ReadOnlySpan<byte> buffer, int width, int height) { - using var image = Image.LoadPixelData<Rgb24>(buffer, width, height); + using var image = Image.LoadPixelData<Rgb24>(new Configuration(), buffer, width, height); using var stream = new System.IO.FileStream(filename, FileMode.Create); var pngEncoder = new SixLabors.ImageSharp.Formats.Png.PngEncoder() { ColorType = SixLabors.ImageSharp.Formats.Png.PngColorType.Rgb diff --git a/csharp/ppm2png.csproj b/csharp/ppm2png.csproj index c079a6e..cc877f5 100644 --- a/csharp/ppm2png.csproj +++ b/csharp/ppm2png.csproj @@ -2,7 +2,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> - <TargetFramework>net7.0</TargetFramework> + <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <RestoreAdditionalProjectSources>https://www.myget.org/F/sixlabors/api/v3/index.json</RestoreAdditionalProjectSources>
I'm attaching intermediate files that can be opened with Sizoscope: native.zip but feel free to make your own.
One immediate issue is that this app also includes support for WebP/JPEG/etc. even though I don't need it.
Sizoscope root cause analysis for WebpEncoder..ctor points to Configuration.Default accessed from here:
WebpEncoder..ctor
Configuration.Default
There might be more issues.
Clone the repo and build the project. Add switches described in the sizoscope repo if you want to inspect with sizoscope.
No response
The text was updated successfully, but these errors were encountered:
Wrong native.zip above. Use this one:
native.zip
Sorry, something went wrong.
No branches or pull requests
Prerequisites
DEBUGandRELEASEmodeImageSharp version
3.0.1
Other ImageSharp packages and versions
?
Environment (Operating system, version and so on)
Windows 11
.NET Framework version
?
Description
As requested on Twitter: https://twitter.com/James_M_South/status/1673489691956625410
When compiling https://github.com/pjmlp/ppm2png/tree/2b77cfc103f48bbcdce0512f6182153d6d4d8644/csharp with PublishAot, the produced executable is rather large. The reason why it's large can be inspected with Sizoscope. I made this change to the above repo in an attempt to make the size smaller but it didn't help much:
I'm attaching intermediate files that can be opened with Sizoscope:
native.zip but feel free to make your own.
One immediate issue is that this app also includes support for WebP/JPEG/etc. even though I don't need it.
Sizoscope root cause analysis for
WebpEncoder..ctorpoints toConfiguration.Defaultaccessed from here:There might be more issues.
Steps to Reproduce
Clone the repo and build the project. Add switches described in the sizoscope repo if you want to inspect with sizoscope.
Images
No response
The text was updated successfully, but these errors were encountered: