XBMC will be renamed to Kodi for v14. Read here for more details

Aspect Ratio

From Kodi
Jump to: navigation, search

The <aspectratio> tag allows the aspect ratio of images (and multiimages) to be defined, and in addition, on how the image should be aligned within the standard <width>,<height> box.

Contents

1 XML tag format

The tag format is:

  <aspectratio scalediffuse="false" align="left" aligny="top">keep</aspectratio>

2 Allowed values

The values allowed for the aspect ratio are keep, stretch, scale, and center. These do the following: In addition to the default control tags, the following tags are available. Note that each tag is lower case only. This is important, as xml tags are case-sensitive.

keep Aspect ratio will be kept, and the image will be scaled down or up so that it fits inside the box, with transparent bars either side if the ratios are not the same.
stretch Aspect ratio is not kept - the image will be stretched so that it exactly fits the box.
scale Aspect ratio is kept, and the image is scaled up so that it fills the box, with any portions that lie outside the box being cropped off.
center Aspect ratio is kept, and the image is left unscaled, centered within the box. It may be cropped if the image is larger than the box, or may have a transparent border if the image is smaller than the box.

3 Attributes

The align and aligny attributes specify how the image is positioned within the box. The default is to align to center in both directions.

Finally, the scalediffuse="false" attribute means the diffuse texture is not scaled to the image size. i.e. the diffuse image effectively uses aspectratio stretch in this case. This is especially useful when using the diffuse image to trim the main image in a particular way, such as to round off the corners. The default is scalediffuse="true".

4 Example

The image below shows the various combinations. The aspect ratios are from left to right: keep, scale, stretch, center. The top images use scalediffuse="true" and the lower images use scalediffuse="false".

Aspectratio image.jpg


5 See also

Development:

Personal tools
Namespaces

Variants
Actions
Navigation
Wiki help
Toolbox