pureweb.client. EncoderFormat

The EncoderFormat class specifies image encoder format parameters. By default, these parameters are the image mime type and quality. However, the methods in this class also allow you to specify any other custom parameters that you want to include with the image. Such parameters could be used, for example, to display image metadata.

The service application provides default encoder formats, which get passed to the client applications; therefore, you would only use this class if you wanted to overwrite the defaults provided by the service.

Method Summary

getMimeType
Returns the mime type currently set in the EncoderFormat object.
getParameter
Returns the parameter associated with the provided name.
getParameters
Returns a list of custom encoding parameters, if any.
getParametersAsObject
Returns a list of custom encoding parameters, if any.
getQuality
Returns the image encoding quality currently set in the EncoderFormat object.
isQualitySet
Returns a Boolean value that indicates whether the quality has been explicitly set.
setMimeType
Sets a mime type value for the image.
setParameter
Adds a custom parameter to the EncoderFormat object, expressed as a name-value pair.
setQuality
Sets an image encoding quality for the EncoderFormat object, if applicable.

Constructor

new EncoderFormat(mimeType, opt_quality, opt_parameters)

Initializes a new instance of EncoderFormat.
Parameters:
Name Type Argument Description
mimeType string The mime type for encoding.
opt_quality number <optional>
<nullable>
The quality for encoding.
opt_parameters Object <optional>
<nullable>
A dictionary of optional encoder format parameters.
Throws:
pureweb.NullArgumentException

Extends

  • pureweb.events.EventTarget

Method Detail

getMimeType() → {string}

Returns the mime type currently set in the EncoderFormat object.

getParameter() → {pureweb.client.EncoderParameter}

Returns the parameter associated with the provided name.

getParameters() → {Array}

Returns a list of custom encoding parameters, if any. This list is expressed as an array of EncoderParameters objects.

getParametersAsObject() → {Object}

Returns a list of custom encoding parameters, if any. This list is expressed as a literal object.

getQuality() → {number}

Returns the image encoding quality currently set in the EncoderFormat object.

isQualitySet() → {boolean}

Returns a Boolean value that indicates whether the quality has been explicitly set.

setMimeType(mimeType)

Sets a mime type value for the image.
Parameters:
Name Type Description
mimeType string The mime type to set.

setParameter(name, value)

Adds a custom parameter to the EncoderFormat object, expressed as a name-value pair. You could use this method, for example, to send metadata along with the image. If a parameter already exists, the value will be overwritten.
Parameters:
Name Type Description
name string The name of the parameter.
value string The value for the parameter.

setQuality(quality)

Sets an image encoding quality for the EncoderFormat object, if applicable. Quality is an integer between 0 and 100 that defines the fidelity (overall clarity and number of visual artifacts) of the images. Setting a value for quality has no impact for PNG images.
Parameters:
Name Type Description
quality number The quality.