MakeImageSquare 0.1.0

dotnet add package MakeImageSquare --version 0.1.0
                    
NuGet\Install-Package MakeImageSquare -Version 0.1.0
                    
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="MakeImageSquare" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MakeImageSquare" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="MakeImageSquare" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MakeImageSquare --version 0.1.0
                    
#r "nuget: MakeImageSquare, 0.1.0"
                    
#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.
#:package MakeImageSquare@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MakeImageSquare&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=MakeImageSquare&version=0.1.0
                    
Install as a Cake Tool

MakeImageSquare

Tiny helper that turns any image size into a 1:1 layout plan: square canvas size plus left/right/top/bottom padding so you can fit without cropping.

Useful when you need the math for letterboxing / pillarboxing before you draw to a canvas, generate CSS object-fit-style boxes, or prep assets for Instagram and profile photos.

Install

dotnet add package MakeImageSquare

Usage

using MakeImageSquare;

// 1200×800 landscape → 1200×1200 with top/bottom pads
var layout = Layout.MakeImageSquare(1200, 800);
Console.WriteLine($"canvas={layout.Canvas} padTop={layout.PadTop}");

// Force a specific square edge (e.g. 1080 for feed posts)
var ig = Layout.MakeImageSquare(1200, 800, SquareMode.Fit, 1080);

// Padding-only helper
var pads = Layout.Padding(800, 1200); // portrait → pad left/right

Modes

Mode Behavior
Fit (default) Entire image visible; empty bands become padding
Fill Image covers the square; caller is expected to crop overflow

Notes

  • This package only returns numbers. It does not decode or rewrite image files.
  • If you want the same 1:1 result without writing GDI+/Skia code, there is a browser tool that pads photos to a square with blur-frame and crop options, no account required.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 109 9/7/2026