Aspect Ratio: Difference between revisions
>Theuni |
>NedBot m (Robot: Cosmetic changes) |
||
Line 1: | Line 1: | ||
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. | 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. | ||
=== XML tag format=== | === XML tag format === | ||
The tag format is: | The tag format is: | ||
<source lang="xml"> | <source lang="xml"> | ||
Line 7: | Line 7: | ||
</source> | </source> | ||
===Allowed values=== | === Allowed values === | ||
The values allowed for the aspect ratio are keep, stretch, scale, and center. | The values allowed for the aspect ratio are keep, stretch, scale, and center. These do the following: | ||
In addition to the [[ | In addition to the [[Default Control Tags|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. | ||
{| class="dtable" | {| class="dtable" | ||
|- class="userrow" | |- class="userrow" | ||
Line 25: | Line 25: | ||
|} | |} | ||
===Attributes=== | === Attributes === | ||
The align and aligny attributes specify how the image is positioned within the box. | 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. | 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". | ||
===Example=== | === Example === | ||
The image below shows the various combinations. | 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". | ||
[[ | [[File:Aspectratio image.jpg]] | ||
[[ | [[Category:Skin Development]] |
Revision as of 16:04, 7 September 2011
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.
XML tag format
The tag format is:
<aspectratio scalediffuse="false" align="left" aligny="top">keep</aspectratio>
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. |
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".
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".