The ccResizeImage binding can be used to convert images to JPEG using the optional outputFormat attribute. When outputFormat is set to JPEG (the only option currently supported), a source image is converted to a JPEG image. You can specify an optional quality attribute to adjust the quality of the resulting JPEG image (0.0 is the lowest quality, 1.0 is the highest quality). For PNG images with a transparency layer, you can control the background color of the converted JPEG (which does not support transparency) by setting the optional alphaChannelColor attribute. For example, the following img tag converts the logo.png image to a JPEG with a quality factor of 0.8 and replaces the transparent layer with the color black.

<img data-bind="ccResizeImage: {
    source: '/img/logo.png',
    outputFormat: 'JPEG',
    alphaChannelColor: '000000',
    quality: '0.8'}"></img>

Note: GIF images cannot be resized or converted to JPEG as they may contain animation which is lost after resizing and conversion.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices