It is possible to create dynamically sized buttons using Scene7 Image Serving. Below are some templates that provide a basis for developing self-sizing UI buttons using IS. The examples use the default font distributed with IS. The derived art must be wide enough to accommodate the longest text label expected. An actual implementation likely would use higher-resolution art, a different font, and various RTF and IS commands to fine-tune the appearance and position of the text label.
The example below has a solid color background.The text must be in layer 0 so that the button size is driven by the text string. The button art must be transparent in the center to make the label and fill visible:
This example has the button art providing the fill. You need to render the text twice; once in layer 0 to provide the overall size, and then again on top of the art. In this case the art would be opaque:
Here is an example used by one of our customers. The primary difference and increased complexity is due to the fact that this call generates transparent PNG buttons. This requires nested calls on layer 1 and layer 2. The developer mode in SPS is needed to create the template.
Unfortunately, at this time we do not support importing layer transforms from PSD files into the generated basic template.
A clipping path is a closed vector path, or shape, used to cut out a 2D image in image editing software. Anything inside the path will be included after the clipping path is applied; anything outside the path will be omitted from the output.
You can use image clipping paths to define transparent areas in images you place in page-layout applications. In addition, OS X users can embed Photoshop images in many word-processor files.
You may want to use only part of a Photoshop image when printing it or placing it in another application. For example, you may want to use a foreground object and exclude the background. An image clipping path lets you isolate the foreground object and make everything else transparent when the image is printed or placed in another application.
Note: Paths are vector-based; therefore, they have hard edges. You cannot preserve the softness of a feathered edge, such as in a shadow, when creating an image clipping path.
If an image contains a clipping path, the clipping path is displayed in the Photoshop “Paths” panel with its name displayed in bold font.
The Scene7 file formats that support clipping paths include:
One of the image editing options in SPS under the upload job options is to create a mask from a clipping path. This help page has a brief description of this option:
When this option is selected and the uploaded image contains a path that is denoted as the clipping path (files can have only one clipping path), the mask is associated with the Asset ID for the uploaded file. Specifically a MaskPath which references an 8-bit greyscale mask image is tied to the asset. The alpha channel for the area outside of the clipping path on the mask image will be completely transparent, and the alpha channel will be completely opaque for the area inside the clipping path. More information about MaskPath can be found in the Image Serving documentation:
The catalog::MaskPath overrides the alpha channel in the main image (catalog::Path), if present, and if the alpha channel is unassociated (i.e. not pre-multiplied). If the image alpha is pre-multiplied, catalog::MaskPath is ignored and the alpha channel of the main image is always used.
The result is that the region outside of the clipping path will be transparent when referred to by the Asset ID from the Image Server. It is possible to ignore the mask by using maskuse=off in the Image Serving URL, which effectively removes the transparency created by the clipping path. See the Image Serving documentation for more information on maskUse.
Here is an example showing the transparency which is created from the mask:
And how you can ignore the mask and therefore lose the transparency:
Glossary of terms
unassociated alpha channel
RGB images with alpha transparency can be stored in two different ways. One way is to store raw RGB values and alpha values as separate and independent channels; this is called "unassociated alpha". PNG standardized on "unassociated" ("non-premultiplied") alpha so that images with separate transparency masks can be stored losslessly. Most image processing programs stores images with unassociated alpha, to be able to manipulate RGB and alpha independently of one another, and not lose RGB data when zeroing out alpha.
pre-multiplied alpha channel
Another way is to store RGB values not raw, but premultiplied by corresponding alpha value, which is then called "associated alpha".
If an alpha channel is used in an image, it is common to also multiply the color by the alpha value. This is usually referred to as premultiplied alpha. "Premultiplied alpha", stores pixel values premultiplied by the alpha fraction. The alpha information of a pixel is not only stored in the alpha channel itself, but it is already "multiplied" into the red, green and blue channel. Rendering software prefers associated alpha, because with RGB values already multiplied by alpha, less work remains to be done in real time when doing alpha blending. TIFF support both types of alpha, but are frequently mis-labelled.
Paths are vector-based drawings that can stretch and re-shape and will not lose detail. In Photoshop, you can use a path as a vector mask for a layer. Vector masks, like paths, can be resized without loss of detail. You can denote one path to be a clipping path, and use it to define transparent areas in images. This allows you to isolate the foreground area and make everything else transparent.
With Scene7, you have the option to create a vector mask upon upload into SPS based on the clipping path. In addition, all path information, including clipping paths, can optionally be returned as part of any dynamically generated image response. It is also possible to use path information to dynamically define transparent areas of a layer or image.
In a future version of Scene7, it may also be possible to dynamically crop a layer or image based on a path.
Upon upload into Scene7, only the clipping path can be used to automatically create a mask. However, we do have support for referencing a named path included in the requested image which will mask out all of the image area that falls outside the path definition. This does not require extracting the path to a mask within SPS, since the path can be used through standard Scene7 Image Serving requests.
Scene7 does support referencing a named path included in the requested image which will mask out all of the image area that falls outside the path definition. This does not require extracting the path to a mask within SPS, since the path can be used with standard Scene7 Image Serving requests.
The image serving command is called clipPathE, and you can find documentation on this command here:
Here are a couple of examples showing the use of clipPathE:
No path called, no transparency:
Path called, shows transparency:
Another image with different paths defined:
This functionality as added in our Spring 2014 release.
There are alternate approaches: The IPS API offers getPhotoshopPath and getPhotoshopPathNames. The image server can crop and mask based on path name.
Developer mode is used when you would like to create template without using the User Interface (UI) design tools. A template will go into developer mode if devmode=true is in the template, or if the parser is not able to parse the template.
The image serving documentation provides some information on the template request command:
From the documentation:
When template= is present, the object specified in the request path will not be applied as the source for layer 0, but can be referenced as a src= or mask= anywhere in the template by using the predefined path variable $object$ as a src= value. catalog::Modifier of the object specified in the request path is only applied in connection with the substitution of $object$ within the template, while catalog::PostModifier is always applied.
Here is an example:
add a new layer 0, to fix issue of hairline not appearing correctly. Layer 0 is downsized to 270x270 because the image is square, and layer 1 therefore is cropped to 270x270:
Use the template feature to allow the template to be used in a preset:
Here is the template (jbsimpletemplate):
And the preset (jbpreset):
By design, only multiple layer PSDs can be converted to a template. A single later template has no advantage as a template and does nothing more that duplicating the number of assets for the company for the image and template.