Home

Awesome

Logo

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

Install

Available on NuGet

NuGet

Usage

The easiest way is to use Assetxport from its build task. Simply add a NuGet 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|UWP>",
  "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": [ "../Assetxport.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 :

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

Platforms

iOS

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

Android

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

UWP

Assets are generated with a qualified suffix indicating the scale (scale-100, scale-240, ...).

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.

License

MIT © Aloïs Deniel