DdsFileTypePlusHack 1.2.1

dotnet add package DdsFileTypePlusHack --version 1.2.1                
NuGet\Install-Package DdsFileTypePlusHack -Version 1.2.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DdsFileTypePlusHack" Version="1.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DdsFileTypePlusHack --version 1.2.1                
#r "nuget: DdsFileTypePlusHack, 1.2.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DdsFileTypePlusHack as a Cake Addin
#addin nuget:?package=DdsFileTypePlusHack&version=1.2.1

// Install DdsFileTypePlusHack as a Cake Tool
#tool nuget:?package=DdsFileTypePlusHack&version=1.2.1                

ddsfiletype-plus-hack

Dirty solution to add DDS BC7 write/read support to .NET using PAINT.NET plugin.

This project is pdn-ddsfiletype-plus plugin for Paint.NET and last open-sourced version of Paint.NET 3.36.7 stripped down to necessary elements.

Usage example

        using PaintDotNet;
        using DdsFileTypePlus;

        void Main()
        {     
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;
            progressBar1.Value = 0;

            Surface surface = DdsFile.Load(@"S:\testDDS\BC7.dds"); //get Paint.NET Surface
            
            System.Drawing.Bitmap bitmap = surface.CreateAliasedBitmap(); // convert to Bitmap
            MagickImage magickImage = new MagickImage(bitmap); // convert to Magick.NET MagickImage
            NetVips.Image vipsImage;
            using (var stream = new MemoryStream())
            {
                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                vipsImage = Image.NewFromBuffer(stream.ToArray()); // convert to NetVips Image
            }
            
            // do something with images
            
            System.Drawing.Bitmap processedBitmap = magickImage.ToBitmap();
            Surface processedSurface = Surface.CopyFromBitmap(processedBitmap);

            System.IO.FileStream fileStream = new System.IO.FileStream(
                @"S:\testDDS\result.dds",
                System.IO.FileMode.Create);   
            
             DdsFile.Save(
                fileStream,
                DdsFileFormat.BC7,
                DdsErrorMetric.Perceptual,
                BC7CompressionSpeed.Fast,
                cubeMap: true,
                generateMipMaps: true,
                ResamplingAlgorithm.Bilinear,
                processedSurface,
                ProgressChanged);
                
            fileStream.Close();
        }

        private void ProgressChanged(object sender, ProgressEventArgs e)
        {
            progressBar1.Value = (int) Math.Round(e.Percent);
        }         
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on DdsFileTypePlusHack:

Repository Stars
n00mkrad/cupscale
Image Upscaling GUI based on ESRGAN
Version Downloads Last updated
1.2.1 2,183 2/23/2023
1.2.0 284 2/3/2023
1.1.0-beta1 479 5/27/2019
1.0.4 3,957 5/20/2019

Make HasTransparency method public