Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dotnet-ad/Assetxport

Resize UWP, Xamarin.Android and Xamarin.iOS assets automatically.
https://github.com/dotnet-ad/Assetxport

assets resize tool xamarin

Last synced: 30 days ago
JSON representation

Resize UWP, Xamarin.Android and Xamarin.iOS assets automatically.

Awesome Lists containing this project

README

        

![Logo](Documentation/Logo.png)

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

## Install

Available on NuGet

[![NuGet](https://img.shields.io/nuget/v/Assetxport.svg?label=NuGet)](https://www.nuget.org/packages/Assetxport/)

## Usage

The easiest way is to use **Assetxport** from its build task. Simply add a [NuGet](https://www.nuget.org/packages/Assetxport/) 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`

```json
{
"Platform": "",
"Input": [ "" ],
"Output": ""
}
```

```json
{
"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 :

* `.` : **1.00**
* `@x.` : **value**
* `@ldpi.` : **0.75**
* `@mdpi.` : **1.00**
* `@hdpi.` : **1.50**
* `@xhdpi.` : **2.00**
* `@xxhdpi.` : **3.00**
* `@xxxhdpi.` : **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!

## 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](https://github.com/mono/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](http://aloisdeniel.github.io)