AssetMan 1.2.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package AssetMan --version 1.2.1                
NuGet\Install-Package AssetMan -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="AssetMan" Version="1.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AssetMan --version 1.2.1                
#r "nuget: AssetMan, 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 AssetMan as a Cake Addin
#addin nuget:?package=AssetMan&version=1.2.1

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

Build develop Test develop

Build main Test main

Resize Xamarin.Android and Xamarin.iOS assets automatically at build time.

Installation and usage

Install package into the platform projects.

The easiest way is to use AssetMan from its build task. Simply add the package reference to your Xamarin.iOS, Xamarin.Android or Universal Windows Platform project and add a Config.assets.json configuration file at the root of your project.

Config.assets.json

{
  "Platform": "<iOS|Android>",
  "Input": [
    "<input folder path relative to this file, containing all the source hd assets>"
  ],
  "Output": "<output folder path relative to this file, where all the density assets are generated to>"
}
{
  "Platform": "iOS",
  "Input": ["../AssetMan.Sample.Cli/Images/"],
  "Output": "Assets.xcassets"
}

In your high definition asset source folder, all .png|.jpg images should have a suffix qualifier indicating their original density. Here is the list of available qualifiers :

  • <name>.<ext> : 1.00
  • <name>@<value>x.<ext> : value
  • <name>@ldpi.<ext> : 0.75
  • <name>@mdpi.<ext> : 1.00
  • <name>@hdpi.<ext> : 1.50
  • <name>@xhdpi.<ext> : 2.00
  • <name>@xxhdpi.<ext> : 3.00
  • <name>@xxxhdpi.<ext> : 4.00

Then simply build the project to generate your various assets (with densities lower or equal to the original density) to the output folder!

The generated files are automatically included in the project, so there is no need to do that manually. I'd also suggest setting up .gitignore to not include the generated files in source control. Currently files are not regenerated if they exist, even if the source asset is updated (this will be fixed).

Platforms

iOS

Assets are generated as asset catalog entries (.imageset).

Android

Assets are generated inside qualified drawable sub folders (drawable-hdpi, drawable-xhdpi, ...).

CLI

The standalone .exe CLI used by the build task is available from the /tools folder of the NuGet package.

Under the hood

The tool uses SkiaSharp to resize all images.

Contributions

Contributions are welcome! If you find a bug please report it and if you want a feature please report it.

If you want to contribute code please file an issue and create a branch off of the current dev branch and file a pull request.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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
1.2.8-g9ef82ef0c9 170 9/21/2023
1.2.7-g6d142a52ec 159 9/21/2023
1.2.6-gf952204298 214 6/2/2023
1.2.2-g59d44ce936 197 6/1/2023
1.2.1 1,198 6/1/2023
1.2.1-g56d0d3d009 170 6/1/2023
1.1.23-g16f51c246b 182 6/1/2023
1.1.19-g65545609c0 191 6/1/2023
1.1.17-gde4ddb8b88 184 6/1/2023
1.1.16-g01aa4b84fc 164 6/1/2023
1.0.1 3,725 12/20/2019
0.9.24 2,355 8/31/2019

- Update SkiaSharp for better MacOS support
- Updated to .NET 6 CLI
- Removed .NET Framework (and thus UWP) support