Home

Shayton Equilibrium Kitchen Utensil 2003 User's Manual

image

Contents

1. RgbColorFromPct red green blue constructs RgbColor from component percentages 0 1 MediaScript Objects and Methods 167 168 Chapter 3 Examples include Sys color ms myColor new RgbColor 0x1133aa print myColor red myColor green myColor blue myColor new RgbColor myColor red 27 myColor green 59 myColor blue 255 media new Media edia makeCanvas xs 100 ys 100 fillcolor myColor version Returns a string that is the current version of MediaScript Syntax version Appendix A MediaRich Metadata Support MediaRich provides support for the most popular metadata formats IPTC Exif and XMP MediaRich fully supports loading saving and merging IPTC Exif and XMP metadata for JPEG TIFF and Photoshop files MediaRich also supports loading XMP metadata from the following file formats Illustrator EPS GIF PDF and PNG This metadata is available to the script as a metadata XML document Detailed schemas are provided for the Exif and IPTC documents constructed by MediaRich The XMP metadata document conforms to the schema defined by Adobe The MediaRich for SharePoint product currently supports only IPTC and Exif metadata for JPEG TIFF and Photoshop files Appendix Summary Low Level Metadata Interface 170 High Level Support for Exif and IPTC 172 169 Low Level Metadata Interface 170 Two MediaScript objects provide support for metadata The Me
2. Layer rotate angle 30 image setLayer 2 Layer setLayerBlend Sets the blending mode of the media layer with the specified index if available Syntax lt object name gt setLayerBlend lt layer index gt lt blending mode gt Parameters The first parameter specifies the layer index starting from 0 The second parameter specifies the blending mode to be used Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under and Colorize causes only the hue component of the source to be stamped down on the image NOTE Burn has been deprecated ColorBurn results in the same blend Example var image new Media image setLayerBlend 2 Difference setLayerEnabled Sets the specified layer as either enabled or disabled If you use the collapse function without naming specific layers MediaRich collapses all enabled layers and ignores disabled layers Use the setLayerEnabled function or the eye icon in Photoshop to enable disable a layer Use the getLayerEnabled function to determine if a layer is enabled or not Syntax lt object name gt setLayerEnabled lt layer index gt lt true false gt e Parameters The first parameter
3. NOTE Get ImageFormat has been deprecated get PixelFormat is the preferred function and will be supported in future versions of MediaScript Syntax lt object name gt getImageFormat Parameters This function has no parameters Example var image new Media image load name peppers psd if image getImageFormat 24 Bit ares getinfo Returns the system version information It is recommended for advanced users only Syntax lt object name gt getInfo lt argument gt e Parameters H AE It takes one of these arguments as a string all devices commands or filing Example var image new Media error image getiInfo all getLayer Returns a Media object for the specified layer if available otherwise returns undefined It takes the specified layer index starting from zero as an argument Syntax lt object name gt getLayer lt layer number gt 3 Parameters layer number specifies the desired layer of the Media object Example var image new Media var newimage new Media newimage image getLayer 2 getLayerBlend Returns the blending mode of the media layer with the specified layer index if available Syntax lt object name gt getLayerBlend lt layer index gt Parameters layer index specifies the desired layer index starting from 0 The blend modes are Normal Darken L
4. Specifying ICC profiles The sourceProfile and destProfile parameters may be specified either as a filename or as an IccProfile object By default profiles are read from the color file system which is defined by default as a combination of the MediaRich Shared Originals Profiles directory and the system color profile directory if there is one The MediaRich Shared Originals Profiles directory is searched first In addition the special profile names rgb and cmyk may be used to designate the default RGB and CMYK profiles specified in the global properties file under the property keys ColorManager DefaultRGBProfile and ColorManager DefaultCMYKProfile respectively You can change these to designate any default RGB or CMYK profiles you want NOTE Ifa Color Profile is associated with an RGB image this is considered unnecessary data and by default the attached profiles will not be saved to RGB images The MediaRich server s local properties file may be modified to change the default profile directory See the MediaRich Administrator s Guide for more information Syntax colorCorrect destProfile lt filename icc gt sourceProfile lt filename icc gt intent lt rendering intent gt overrideEmbedded lt true false gt Parameters dest Profile specifies the destination profile After an image has been colorCorrected this profile becomes the embedded profile for the i
5. Syntax sharpenUnsharpMask Radius lt value 0 10 250 gt Amount lt value 1 500 gt Threshold lt value 1 255 gt i Parameters Radius specifies the extent of the blurring effect The default is 1 Amount specifies the extent of the enhancing effect The default is 50 Threshold specifies the degree to which a blurred version of a pixel must be different from the original version before the enhancement takes effect The default is 0 Example var image new Media image load name peppers tga image sharpenUnsharpMask Radius 18 Amount 450 Threshold 125 image save type jpeg sizeText Returns the width height and lines for the specified parameters This function is available on Windows only Syntax sizeText text lt string gt font lt font family gt style lt modifier gt Size lt value 1 4095 gt justify lt justify gt Justify lt left center right justified gt spacing lt spacing gt Line lt value 01 to 10 gt smooth lt true false gt clearType lt clearType gt kern lt true false gt ClearType lt true false gt windows only Return Values width the overall width of the text in pixels height the overall height of the text in pixels lines the number of lines of text that will be drawn MediaScript Objects and Methods 143 144 Chapter 3 Parameters F
6. Under Colorize causes only the hue component of the source to be stamped down on the image and Prenormal NOTE Burn has been deprecated ColorBurn results in the same blend Width specifies the thickness in pixels of the line that describes the arc The default value is 1 However if the Fill parameter is set to true the Width parameter is ignored Smooth when set to true makes the edges of the arc smooth preventing a pixellated effect The default is false Fill when set to true fills in the arc with the color specified by the Color or Index parameter The default value is false Warpangles when set to true warps the angles to match the ellipse The default value is false Example var image new Media image load name logobg tga image arc X 185 Y 121 Rx 175 Ry 111 StartAngle 120 EndAngle 60 Width 2 Smooth true WarpAngles true image save type jpeg blur Applies a simple blur filter on the image For each pixel all the pixels within the given radius are averaged and the result put in the destination image This function fully supports CMYK NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection Syntax blur Radius lt value 0 30 gt Parameters Radius specifies the radius
7. lt value 360 360 gt Opacity lt value 0 255 gt Unlock lt color in hexadecimal or rgb gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Saturation lt value 0 255 gt PreserveAlpha lt true false gt Blend lt blend type gt Width lt value gt Smooth lt true false gt Fill lt true false gt Warpangles lt true false gt Parameters The arc is created as a portion of a defined ellipse X specifies in pixels the x axis coordinate for the center point of the ellipse from which the arc is derived This parameter is required and has no default value Y specifies in pixels the y axis coordinate for the center point of the ellipse from which the arc is derived This parameter is required and has no default value Rx specifies in pixels the radius of the ellipse from which the arc is derived on the x axis This parameter is required and has no default value MediaScript Objects and Methods 51 52 Chapter 3 Ry specifies in pixels the radius of the ellipse from which the arc is derived on the y axis This parameter is required and has no default value Startangle indicates the point of the ellipse from which the arc is derived where the arc begins This parameter is required There is no default value Endang e indicates the point of the ellipse from which the arc is derived where the arc ends This parameter is
8. or black MediaScript Objects and Methods 109 110 Chapter 3 Other Style parameters are Underline Italic or Italics and Strikethru or Strikeout NOTE You can combine Style parameters For example Style Bold Italic Text specifies the text to be drawn The text string must be enclosed in quotes To indicate a line break insert n into the text Size sets the point size of the font to be used The default size is 12 Spacing adjusts the spacing between the text characters The default is 0 NOTE A negative Spacing value draws the text characters closer together Smooth specifies that the text is drawn with five level anti aliasing ClearType if specified as true the Windows ClearType text renderer will be used if available Kern if set to true optimizes the spacing between text characters By default this is set to true If you do not want to use kerning this must be specified as false NOTE PostScript fonts store the Kerning information in a separate file with a afm extension This file must be present in order for kerning to be applied to the text noiseAddNoise Applies random pixels to an image to simulate a noise effect NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 S
9. 168 Z ZigZag 215 zoom 164 194 MediaRich Programming Guide
10. Sets the response object Optional parameters can set the response type and save parameters for the specified object Syntax resp setObject obj respType saveParams Parameters obj specifies the response object RespType optional parameter that sets the response type e RespType Cached the default saves the response object or file to the MediaResults cache directory so that future requests are returned directly by the filter e RespType Streamed bypasses the cache and returns the response data directly to the filter e RespType Path returns the full native path of a file to the filter but does not copy the file to the cache For more information see setResponseType saveParams optional parameter that saves response parameters as an object The object must be pre existing or a temporary object using the syntax Example var img new Media img load name foo jpg resp setObject img RespType Streamed type png getObject Returns the object previously set by either setObject setMedia ora Media save call with no name NOTE If no response object is set the function returns null MediaScript Objects and Methods 37 38 Chapter 3 Syntax resp getObject Parameters This function has no parameters setPath Sets the response file path An optional parameter can set the response type Syntax resp setPath filePath RespType Parameters filePath
11. equilibrium MEDIARICH MediaRich for SharePoint 2003 Programmer s Guide 2003 2006 Automated Media Processing Solutions Inc dba Equilibrium All Rights Reserved U S Pat No 6 792 575 for automated media processing and delivery Other patents pending Equilibrium MediaRich the MediaRich and Equilibrium logos and MediaScript are trademarks of Equilibrium Adobe and Photoshop are registered trademarks of Adobe Systems Inc All other products or name brands are the trademarks of their respective holders MediaScript contains ScriptEase a JavaScript compatible ECMAScript compliant interpreter developed by Nombas Inc http www nombas com All Rights Reserved v 3 6 194 0 Table of Contents Chapter 1 Chapter 2 Chapter 3 Programming MediaRich for SharePoint 5 MediaRich for SharePoint 2003 Features 6 The Application Programming Framework T Working with MediaScript 7 Using the processlmage Function 8 Deploying a New MediaScript 9 Metadata Support 9 Using MediaScript 11 The Media Object 12 Preprocessor Directives 12 Using the include Directive 12 Using the link Directive 13 Named Arguments 13 File Systems 14 File System Specifiers 14 Creating Custom File System Aliases 15 File Filesystem 16 HTTP Support Using the FSNet Plug in 17 Configuring the FSNet File Systems 20 MediaScript Objects and Methods 23 Error Handling 24 File Object 24 Object Methods 24 Global Request and Response Objects 30 Set
12. getHeight or getWidth function MediaScript Objects and Methods 129 130 Chapter 3 This function can be used in conjunction with the following functions adjustHsb adjustRgb blur blurBlur blurGaussianBlur blurMoreBlur blurMotionBlur colorize composite equalize noiseAddNoise otherHighPass otherMaximum otherMinimum pixellateMosaic pixellateFragment sharpenSharpen sharpenSharpenMore sharpenUnsharpMask stylizeDiffuse stylizeEmboss stylizeFindEdges and stylizeTraceContour Syntax selection Source lt user defined Media object name gt Fill lt value 0 255 X lt pixel gt Y lt pixell BackColor lt true false gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt ColorType lt Cyans Magentas Yellows Reds Greens Blues Hilites Midtones Shadows gt Invert lt true false gt Remove lt true false gt Opacity lt value 0 255 gt Radius lt value 1 600 gt layers lt layer list gt PSD files only e Parameters You specify the area of selection using one of two sets of parameters Using Source When you use Source the system interprets the image as a grayscale if it is not one Loading a selection replaces one that is already active NOTE The Name parameter has been deprecated e Before creating a new selection you must load the image
13. image composite source image2 image save type jpeg gradient Composites a color gradient onto the source image This method accepts all composite parameters except HandleX and Handley Syntax gradient adjust lt true false gt style lt Linear Radial Angle Reflected Diamond gt angle lt 0 360 gt scale lt 10 150 gt reverse colorl lt RGBcolor gt color2 lt RGBcolor gt gradient lt RedGreen VioletOrange BlueRedYellow BlueYellowBlue OrangeYellowOrange VioletGreenOrange YellowVioletOrangeBlue Copper Chrome Spectrum MediaScript Objects and Methods 95 96 Chapter 3 opacity lt value 0 255 gt blend lt blend type gt layers lt layer list gt PSD files only Parameters adjust when specified all the other parameters except colorl color2 gradient and reverse which have their usual meaning are ignored The image is then interpreted as a grayscale image which is then passed through the specified gradient giving a new false color image This operates the same way as the GradientMap adjustment layer in Photoshop style specifies a common style for the gradient The available styles are Linear Radial Angle Reflected and Diamond angle specifies the value of the angle at which the gradient is applied This value can range from 0 to 360 to indicate the degree of the angle scale specifies a scale to be applied to t
14. lt object name gt getBytesPerPixel Parameters This function has no parameters Example if image getBytesPerPixel 3 Pasi NOTE Ifyou want MediaRich to return the bit depth of the image use the get ImageFormat function getFrame Returns a Media object for the specified frame if available otherwise returns undefined Syntax lt object name gt getFrame lt frame offset gt Parameters This function takes the specified frame offset starting from 1 as an argument Example var image new Media image load name Images clock gif Load an animated GIF with four frames image2 image getFrame 2 image2 save name frame2 gif getFrameCount Returns the number of frames in an animation Syntax lt object name gt getFrameCount Parameters This function has no parameters Example for x 0 x lt image getFrameCount x sce getHeight Returns the vertical size in pixels Syntax lt object name gt getHeight Parameters This function has no parameters MediaScript Objects and Methods 83 84 Chapter 3 Example if image getHeight 480 Paas getiImageFormat Returns a string representing the image type 8 Bit Palette 8 Bit Grayscale 15 Bit 5 5 5 16 Bit 5 6 5 16 Bit 1 5 5 5 18 Bit 6 6 6 24 Bit 32 Bit RGBA 32 Bit HSV 32 Bit HLS or Undefined
15. pasta tga image fixAlpha image save type jpeg flip Flips the media vertically or horizontally This function fully supports images within the CMYK color space Syntax flip Axis lt Horizontal Vertical gt layers lt layer list gt PSD files only Parameters Axis designates along which axis horizontal or vertical to flip the media layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name pasta tga image flip axis horizontal image save type jpeg frameAdd Adds the given frame s to the specified Media object If the Media object already contains one or more images any frames added are cropped and converted to match the first frame in the media This function fully supports the CMYK color space Before you can add a frame you must load the image you want to add NOTE When using frameAdd within a JavaScript for loop including Draw functions line ellipse etc within the loop to mask other frames can result in initially poor anti aliasing Syntax frameAdd Source lt user defined Media object name gt Name lt filename virtualfilesystem filename gt Duration lt 1 300000 gt MediaScript Objects and Methods 81 82 Chapter 3 Parameters Source
16. type specifies the file type of the saved image otherwise the type is derived from the extension of the file name Valid type names are bmp eps gif jpeg pex pict png ppm psd swf tff targa and wbmp f Saving an image as an SWF file creates a single frame animation that can then be imported into a Flash movie H u NOTE The following formats support saving in the CMYK color space eps psd tif and JPS embedICCProfile if set to true indicates that any destination profile associated with the image be embedded if the file format supports this NOTE The save function supports ICC profiles for EPS JPEG PSD and TIFF files However save has been deprecated and no longer does any color conversion ColorCorrect must now be used explicitly for converting from RGB to CMYK or visa versa Parameters for Color Profile Specifications srcProfile destProfile and intent are no longer supported by save SaveMetadata if specified as true any metadata associated with the image will be embedded in the image If the target file format does not support metadata this parameter has no effect For more information about MediaRich s metadata support see Appendix A MediaRich Metadata Support on page 169 Additional Parameters for GIF Files Loopcount sets the number of times the frames pl
17. 79 convert 82 crop 83 flip 97 rotate 138 rotate3d 139 scale 144 selection 145 zoom 164 image size 22 include 30 informational parameters 179 Ink Outlines 204 interlaced 142 intermediate file specification 118 isDirectory 44 isFile 44 J JPEG files 142 L layers collapsing 73 loading 118 length 44 line 115 link 31 list 44 load 117 191 M makeCanvas 121 makeText 122 Media Object components 59 153 clone 73 embeddedProfile 94 getBitsPerSample 98 getBytesPerPixel 98 getFrame 99 getFrameCount 99 getHeight 99 getImageFormat 100 getInfo 100 getLayer 100 getLayerBlend 101 getLayerCount 101 getLayerEnabled 102 getLayerHandlex 102 getLayerHandleY 102 getLayerlIndex 103 getLayerName 103 getLayerOpacity 104 getLayerX 104 getLayerY 105 getMetaData 105 getPixel 106 getPopularColor 107 getResHorizontal 108 getResVertical 108 getSamplesPerPixel 108 getWidth 109 new Media constructor 64 setFrame 149 setLayer 150 setLayerBlend 150 setLayerEnabled 151 setLayerHandleX 151 setLayerHandleY 152 setLayerOpacity 152 setLayerPixels 152 setLayerX 153 setLayerY 153 MediaGenWebService 13 Mezzotint 218 mkdir 44 Mosaic Tiles 237 MRL Parameters and Syntax 25 multi frame parameters 180 192 N new Media 64 noiseAddNoise 126 non executing parameters 179 Note Paper 226 NTSC Colors 241
18. Bas Relief 221 Chalk amp Charcoal 222 Charcoal 223 Chrome 224 Graphic Pen 224 Halftone Pattern 225 MediaRich Programming Guide Note Paper 226 Photocopy 227 Plaster 227 Reticulation 228 Stamp 229 Torn Edges 230 Water Paper 230 Slice 23 Smart Blur 200 Smudge Stick 196 Solarize 233 Spatter 205 Specifying ICC profiles 75 Spherize 213 Sponge 196 Sprayed Strokes 206 Stained Glass 238 Stamp 229 Stproc object 31 179 Stroke 201 Stylize Filters 231 Extrude 231 Glowing Edges 232 Solarize 233 Tiles 234 Wind 234 stylizeDiffuse 161 stylizeEmboss 162 stylizeFindEdges 162 stylizeTraceContour 163 Sumi e 207 System Object 168 text rendering 87 122 Text Response Object 169 Text Response Object components append 170 getText 170 getTextType 170 getType 170 setText 170 setTextType 171 TextResponse 169 TextResponse 169 Texture Filters 235 Craquelure 235 Grain 236 Mosaic Tiles 237 Patchwork 238 193 Stained Glass 238 Texturizer 239 Texturizer 239 TIFF files 143 TIFF preview 142 Tiles 234 Time to live 25 Torn Edges 230 transparency 145 Twirl 213 U Underpainting 197 User Profile Information 24 V version 184 Video Filters De Interlace 240 NTSC Colors 241 W Water Paper 230 Watercolor 198 watermarks digimarcDetect 85 digimarcEmbed 85 Wave 214 WBMP files 119 Wind 234 write 46 writing files 140 X Xmldocument object 30 XMLDocument Object components 166
19. For more information see the section about specifying ICC profiles in colorCorrect on page 59 intent the rendering intent to use for the conversion This is an optional parameter Example emykcolor image colorToImage color 0xaa0000 SourceProfile rgb This example converts the color red to the colorspace defined by the profile embedded in image If image has no embedded profile an exception is thrown Assuming the image is a CMYK image with an embedded profile the resulting color will be the CMYK color corresponding to color For more information please see Appendix B MediaRich Color Management composite Composites the specified foreground source image onto the current background image The image specified by source must be loaded separately The background and source images can be any bit depth Transparency is available only for 16 bit 32 bit 40 bit CMYK A images with the alpha channel of the source image being used to determine transparency levels NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 This function also frequently uses Media object components such as getHeight getWidth and others Syntax composite Source lt user defined Media object name gt Name lt filename virtualfilesystem filename
20. Syntax discard Example var image new Media image load name peppers tga image discard drawText Composites the specified text string onto the image This function fully supports CMYK image operations The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution including the CMYK color space MediaRich uses white NOTE Using drawText within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the text object outside the loop Syntax drawText Font lt font family virtualfilesystem font family gt Style lt modifier gt Text lt string gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Unlock lt color in hexadecimal or rgb gt Saturation lt value 0 255 gt Size lt value gt Justify lt left center right justified gt Wrap lt pixel width gt MediaScript Objects and Methods 71 Opacity lt value 0 255 gt X lt pixel gt Y lt pixel gt HandleX lt left center right gt HandleY lt to
21. Then use the Source parameter to refer to that image by its user defined Media object name e Ifthe source and target images are of different size use the Fill parameter to specify what value pixels have in the selection mask that fall outside the size of the selection image The default is 0 e The X parameter determines at what horizontal position the top left corner of the source image is placed on the target image If the X parameter is not specified the selection image will be centered over the target image horizontally e The Y parameter determines at what vertical position the top left corner of the source image is placed on the target image If the Y parameter is not specified the selection image will be centered over the target image vertically e Using Backcolor Color Index or ColorType Use one of these parameters to create a selection from an image that includes all pixels that match the specified color or color type The color can be specified as the background color or as all pixels of a specified color index value or color type In the event that a selection containing everything except a particular color is required the invert parameter can be added to the command Invert reverses the opacity values of the current selection for example 0 gt 255 and 255 gt 0 NOTE If the invert parameter is used it will invert both the opacity and the backcolor color and index values If you desire to invert one b
22. This default behavior is controlled by the ColorManager DefaultEmbedProfile property in the global properties file IccProfile Object The IccProfile object constructor will construct an IccProfile object given either a Media object that has an embedded profile or a path to a profile on disk An IccProfile object may be used as a source or destination profile for all color management methods that take profiles as arguments including e getPath getName e getClass e getColospace getConnectionspace list getPath The getPath method returns the path to the profile on disk or the empty string if the object was constructed from an image getName The getName method returns the profile name getClass The getClass method returns the profiles class The class generally describes the type of the device for which the profile is intended getColospace The getColorspace method returns the colorspace of the device characterized by the profile This is the colorspace of the source image if the profile is used as the source and the colorspace of the destination image if the profile is used as the destination getConnectionspace The getConnectionspace method returns the common colorspace used to construct transforms using this profile MediaRich Color Management 185 list The list method is a static method that returns an array of profile names that match specified class and colorspace criteria
23. This method may be used for example to return a list of all Monitor profiles that have an RGB colorspace Specifying Profiles The methods colorCorrect colorFromImage colorToImage and setSourceProfile all take a SourceProfile argument a DestProfile argument or both There are three methods for specifying these profiles e Specify the path to a profile on disk By default this path is relative to the color virtual file system which includes both the Originals Profiles directory in the Shared files folder and the system color profile directory e Use an IccProfile object These object may be constructed either from a path to a profile on disk or from an image with an embedded profile e Use the default profiles by specifying the string rgb for the default RGB colorspace profile or cmyk for the default CMYK colorspace profile These default profiles are defined in the global properties file Accuracy and Reversibility of Color Conversions 186 The quality of the color reproduction of an image converted from one colorspace to another depends on the following factors e The overlap between the gamut of the source device and the gamut of the destination device e The quality of the color profile used i e the number of samples used to generate the conversion transform e The accuracy of the color profile e The rendering intent selected Devices with similar gamuts will produce the smallest color distort
24. You can combine Style parameter values For example Style Bold Italic line Draws a line across the image based on the specified parameters This method accepts all composite parameters except HandleX and Handley The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution MediaRich uses white NOTE Using line to mask frames within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the masking line outside the loop Syntax line X1 lt pixel gt Y1 lt pixel gt X2 lt pixel gt Y2 lt pixel gt Opacity lt value 0 255 gt Unlock lt color in hexadecimal or rgb gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Saturation lt value 0 255 gt PreserveAlpha lt true false gt Blend lt blend type gt Width lt value gt Smooth lt true false gt Parameters X1 indicates in pixels the x axis coordinate of the line start point This parameter is required and has no default value Y1 indicates in pixels the y axis coordinat
25. e gquadWarp e reduce rectangle rotate e rotate3d e save e saveEmbeddedProfile e scale e selection setColor setFrame setLayer e setLayerBlend e setLayerEnabled e setLayerHandlex e setLayerHandleYy e setLayerOpacity e setLayerPixels setLayerxX setLayerY e setMetadata e setPixel e setResolution e setSourceProfile e sharpenSharpen sharpenSharpenMore e sharpenUnsharpMask e sizeText stylizeDiffuse e stylizeEmboss stylizeFindEdges stylizeTraceContour e zoom new Media The Media object needs to be constructed using the new Media constructor Syntax var Test new Media 48 Chapter 3 adjustHsb Alters the HSB levels of an image It can be applied to images of all supported bit depths NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection Syntax adjustHsb Hue lt value 255 gt Saturation lt value 255 gt Brightness lt value 255 gt USeHLS lt value true false gt Parameters The default value for any parameter not specified is zero Hue an angular color value so the results from hue 255andhue 255 are almost identical Saturati
26. e jpg outputs TIFF files using the JPEG compression scheme NOTE When the JPG compression scheme is specified a CompressionQuality parameter can optionally be supplied in the save function CompressionQuality sets the level of quality on a scale from 0 to 100 This parameter controls the quality vs compression ratio high values produce large files with better quality and lower values produce smaller files with poorer quality e 1zw outputs a lossless dictionary based compression which results in fair compression ratios for most images it produces a compression ratio of about 2 1 e packbits uses a Run Length Encoded RLE compression Example var image new Media image load name peppers tif image save type gif interlaced true loopcount 100 removeduplicates true delay 400 saveEmbeddedProfile Saves the profile embedded in an image to the disk file specified Syntax saveEmbeddedProfile name lt filename icc gt Parameters name specifies the name of the file where the profile is to be stored The string must be in quotes If the string does not specify a file system the default is the color file system See File Systems on page 14 for more information MediaScript Objects and Methods 127 128 Chapter 3 scale Scales the image to the specified size This function fully supports the CMYK color space Syntax scale Alg lt Fast Smooth O
27. false gt i Parameters Font specifies the TrueType or PostScript font family name to be used for example Arial MediaRich supports Type 1 pfa and pfb PostScript fonts only NOTE The size of the font in pixels is dependent on the resolution of the resulting image If the resolution of the image is not set zero the function uses a default value of 72 dpi The default location for fonts specified in a MediaScript is the fonts file system Which includes both the MediaRich Shared Originals Fonts folder and the default system fonts folder If a MediaScript specifies an unavailable font MediaRich generates an error NOTE You can modify the MediaRich server s local properties file to change the default fonts directory See Installing and Managing MediaRich for more information Style specifies the font style You can use any combination of modifiers Each modifier should be separated by a space character NOTE The Style parameter is not available if MediaRich is running on Mac Linux or Solaris Weight modifiers modify the weight thickness of the font Valid weight values in order of increasing thickness are e thin e extralight or ultralight e light e normal or regular e medium e semibold or demibold semi or demi are also acceptable e bold e extrabold or ultrabold extra or ultra are also acceptable e heavy
28. gt Onto lt true false gt Opacity lt value 0 255 gt Unlock lt color in hexadecimal or rgb gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Saturation lt value 0 255 gt FixAlpha lt true false gt PreserveAlpha lt true false gt IgnoreAlpha lt true false gt X lt pixel gt Y lt pixel gt HandleX lt left center right gt Handley lt top middle bottom gt Tile lt true false gt Blend lt blend type gt NOTE Before you can composite an image you must load it Parameters Source specifies the image using its user defined Media object name This parameter does not require quotes Name specifies the image by its name and extension such as airplane jpg Use this parameter if you are compositing with an image that you have not yet loaded MediaScript Objects and Methods 63 64 Chapter 3 If Source or Name is not specified MediaRich will perform a color fill when you also specify the Color parameter For example if you composite without naming a source and specify the color green 0x009900 the green will appear composited over the entire background or onto the area of the background as specified through a selection as with the following example var image new Media var image2 new Media image load name car tga image2 load name mskcar tga image selection source
29. is not specified the marquee is centered on the image layers for PSD files specifies the layers to be cropped The layer numbers begin at 0 background and go up For more information see load on page 101 Padcolor or Padindex specifies the color to be used where the new image dimensions extend beyond the current image If a pad color is not specified the image s background color is used by default For more information about setting an image s background color see setColor on page 131 Transparency specifies the transparency 255 is opaque and 0 is transparent of the padded area s alpha channel This parameter is useful when the cropped image is used in a composite function NOTE If the cropped image is not 32 bit before cropping the transparency information is not used on the next composite function Alg when set to anything other than Normal the area specified or the whole image if no area was defined is scanned and the area to crop shrunk accordingly e BackColor trims away the background areas only e Color trims away areas that match the pad color e Alpha trims away areas with transparent alpha channels NOTE Using Alg Alpha onan image with no alpha channel but which has transparency on will give the same results as Alg BackColor Example var image new Media image load name peppers tga image crop xs 20 ys 16 S padcolor Oxe0e0e0 ima
30. s upper left corner TopRightX and TopRightyY represent the upper right corner of the area to be warped The default is the original image s upper right corner BotLeftxX and BotLefty represent the lower left corner of the area to be warped The default is the original image s lower left corner BotRightX and BotRightyY represent the lower right corner of the area to be warped The default is the original image s lower right corner layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name peppers tga image quadWarp TopLeftX 10 TopLeftY 20 TopRightX 440 TopRightY 480 BotLeftX 40 BotLeftY 780 BotRightX 640 BotRightY 0 smooth true image save type jpeg rectangle Draws and positions a rectangle on the image based on the specified parameters This method accepts all composite parameters except HandleX and Handley The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution
31. specifies the type of text using one of the following predefined values A e TextResponse TypePlain to save text as a plain text file with extension txt TextResponse TypeHtml to save text as an HTML file with extension html TextResponse TypeXml to save text as an XML file with extension xml Example include sys TextResponse ms function main var strObject new TextResponse TextResponse TypePlain strObject setText FOO FOR YOU strObject append nAND FOO FOR ME resp setObject strObject RespType Streamed MediaScript Objects and Methods 153 154 Chapter 3 append Appends the given text string to the text associated with the named object Syntax lt object name gt append lt text string gt Parameters This function takes only a text string which must be enclosed in quotation marks getText Returns the text associated with the named object Syntax lt object name gt getText Parameters This function has no parameters getTextType Returns the text type associated with this object TextResponse TypePlain TextResponse TypeHtml or TextResponse TypeXml For more information about text types see TextResponse on page 153 Syntax lt object name gt getTextType Parameters This function has no parameters getType Returns the type of the named object which is always TextResponse Syn
32. the destination colorspace and the operations to be performed Common Color Management Questions How do I color correct RGB images that do not have embedded profiles Specify a source profile to the colorCorrect function This source profile will only be used for images that do not have an embedded source profile If you specify the string rgb as the source profile for colorCorrect the default RGB profile specified in the global properties file will be used for any image that lacks a source profile image colorCorrect SourceProfile rgb DestProfile myPrinterProfile Intent RelativeColorimetric How do I composite an RGB image on to an CMYK image You must first convert the RGB image to the CMYK colorspace of the image The simplest method for performing this conversion is to construct an IccProfile object from the CMYK image This IccProfile object may then be used as the destination profile for the conversion For example suppose that the CMYK image is contained in a Media object named cmykImage and the RGB image is contained in a Media object named rgbImage The following script will perform the composite emykProfile new IccProfile cmykImage rgbImage colorCorrect SourceProfile rgb DestProfile cmykProfile Intent Perceptual cmykImage composite source rgbImage NOTE The new IccProfile cmykImage method will throw an exception if cmykImage does not contain an embedded profile Wh
33. 179 custom file system aliases 33 Cutout 188 D Dark Strokes 203 Database object 31 179 databases interacting with 179 working with 31 DeBabelizer 142 De Interlace 240 Difference Clouds 220 Diffuse Glow 208 Digimarc support digimarcDetect 85 digimarcEmbed 85 directives include 30 link 31 discard 87 Distort plug in filters Diffuse Glow 208 Glass 209 Ocean Ripple 210 Pinch 211 Polar Coordinates 211 Ripple 212 Spherize 213 Twirl 213 Wave 214 ZigZag 215 DPI resolution 156 drawing methods arc 67 drawText 87 ellipse 92 line 115 makeText 122 polygon 130 rectangle 133 drawText 87 dropShadow 91 Dry Brush 189 E ellipse 92 embeddedProfile 94 EPS files 118 142 equalize 95 error handling 40 error 182 190 ExectyeScriptStream 14 ExecuteScript 14 ExecuteScriptCache 13 exists 42 exportChannel 95 exportGun see exportChannel Extrude 231 F file formats 140 File Object 40 46 File Object components getFileName 42 getFilePath 42 File Object methods close 41 copy 42 File 41 getParentPath 43 isDirectory 44 isFile 44 length 44 list 44 mkdir 44 read 45 readNextLine 45 rename 45 rmdir 46 write 46 File 41 Film Grain 190 filtering methods blur 69 blurBlur 70 blurGaussianBlur 71 blurMoreBlur 71 blurMotionBlur 72 convolve 83 dropShadow 91 glow 109 noiseAddNoise 126 otherHighPass 127 otherMaximu
34. ClearType text renderer will be used if available stylizeDiffuse Makes the image appear as though viewed through a soft diffusion filter with options to lighten or darken the effect Syntax stylizeDiffuse Radius lt value 0 10000 gt Mode lt mode NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Parameters Radius specifies the extent of the diffusion effect The default is 1 almost no effect Mode indicates the diffusion mode such as Lighten and Darken The default is Normal no lightening or darkening effect Example var image new Media image load name peppers tga image stylizeDiffuse Radius 10 Mode Lighten image save type jpeg MediaScript Objects and Methods 145 146 Chapter 3 stylizeEmboss Makes the image appear as though embossed on paper NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax stylizeEmboss Height lt value 1 10 gt Angle lt value 360 360 gt Amount lt value 1 500 gt Parameters Height determines the depth of the embossing effect The def
35. If the Fill parameter is set to true Width is ignored Smooth if set to true makes the edges of the polygon smooth preventing a pixellated effect The default is false Fill if set to true fills in the polygon with the color specified by the Color or Index parameter The default is false Example var image new Media image load name logobg tga image polygon points 200 20 350 222 50 222 200 20 width 3 image save type jpeg quadWarp Moves the corners of the source image to the specified locations warping the image accordingly The top left corner of the source image is represented by the coordinates 0 0 NOTE This is a linear transformation so while it can be used to fake small 3D rotations for greater angles the lack of perspective will become apparent This function fully supports the CMYK color space Syntax quadWarp Smooth lt true false gt TopLeftX lt position gt TopLeftY lt position gt BotLeftX lt position gt BotLeftY lt position gt BotRightX lt position gt BotRightY lt position gt TopRightX lt position gt TopRightY lt position gt layers lt layer list gt PSD files only Parameters Smooth provides for smooth edges when warping the image using non right angles TopLeftX and TopLefty represent the upper left corner of the area to be warped The default is the original image
36. O Ocean Ripple 210 ODBC databases 31 179 opening files 117 otherHighPass 127 otherMaximum 127 otherMinimum 128 P page range 118 Paint Daubs 191 Palette Knife 192 palettes 135 Patchwork 238 PDF files 118 Photocopy 227 Photoshop files 73 118 Photoshop filters default parameters 186 foreground background colors 187 Pinch 211 Pixelate Filters 216 Color Halftone 216 Crystallize 217 Mezzotint 218 Pointillize 219 pixellateFragment 129 pixellateMosaic 130 Plaster 227 Plastic Wrap 193 PNG files 142 Pointillize 219 Polar Coordinates 211 polygon 130 Poster Edges 194 preview 142 print 183 PS files 118 PSD files 118 Q quadWarp 132 MediaRich Programming Guide R Radial Blur 199 read 45 readNextLine 45 rectangle 133 reduce 135 rename 45 Render Filters Clouds 220 Difference Clouds 220 resolution 156 Response Types 47 Reticulation 228 rgb 183 Ripple 212 rmdir 46 rotate 138 rotate3d 139 Rough Pastels 194 S save 140 scale 144 selection 145 setColor 147 setFrame 149 setLayer 150 setLayerBlend 150 setLayerEnabled 151 setLayerHandleX 151 setLayerHandleY 152 setLayerOpacity 152 setLayerPixels 152 setLayerX 153 setLayerY 153 setResolution 156 setSourceProfile 157 setText 170 setTextType 171 Setting the Response Contents 46 sharpenSharpen 157 sharpenSharpenMore 158 sharpenUnsharpMask 158 Sketch Filters 221
37. Sys media ms image new Media image loadAsRGB name myImage tif Now irrespective of the colorspace of the image stored in myImage tif the image is an RGB image Appendix B Index Symbols include 30 link 31 A Accented Edges 201 adjustHsb 65 adjustRgb 66 Angled Strokes 202 append 170 arc 67 Artistic Filters 187 Colored Pencil 188 Cutout 188 Dry Brush 189 Film Grain 190 Fresco 191 Paint Daubs 191 Palette Knife 192 Plastic Wrap 193 Poster Edges 194 Rough Pastels 194 Smudge Stick 196 Sponge 196 Underpainting 197 Watercolor 198 B Bas Relief 221 blank canvas 121 Blur plug in filters Radial Blur 199 Smart Blur 200 blur 69 blurBlur 70 blurGaussianBlur 71 blurMoreBlur 71 blurMotionBlur 72 Brush Stroke plug in filters Accented Edges 201 Angled Strokes 202 Crosshatch 203 Dark Strokes 203 Ink Outlines 204 Spatter 205 Sprayed Strokes 206 Sumi e 207 C Chalk amp Charcoal 222 Charcoal 223 Chrome 224 clone 73 close 41 Clouds 220 collapse 73 Color Halftone 216 color management 246 color space methods adjustHsb 65 adjustRgb 66 colorCorrect 75 colorize 76 equalize 95 fixAlpha 96 reduce 135 setColor 147 colorCorrect 75 Colored Pencil 188 colorize 76 composite 79 compression 142 convert 82 convolve 83 copy 42 Craquelure 235 Crop 22 crop 83 Crosshatch 203 Crystallize 217 Cursor object 31
38. The following methods may be used to get and set metadata values for IPTC metadata Please refer the schema IPTC xsd in the Shared Originals Sys folder for the required format for each of the IPTC fields Note that only a brief description is provided here For a complete description of each IPTC metadata field please consult the IPTC news photo metadata specification available at http www iptc org under the title Digital Newsphoto Parameter Record In the following table the notation string indicates that multiple values may be specified as arguments to the method Method Description getVersion Returns the version field setVersion string Sets the version field getObjectTypeReference Returns the object type reference field setObjectTypeReference string Sets the object type reference field getObjectAttributeReference Returns an array of attribute references setObjectAttributeReference Sets attribute references string addobjectAttributeReference Adds an attribute references to the list string setObjectAttributeReferenceArray Sets a group of attribute references from an Array array getObjectName Returns the object name setObjectName string Sets the object name getEditStatus Returns the edit status setEditStatus string Sets the edit status getEditorialUpdate Returns the editorial update code setEditorialUpdate string Sets the editorial
39. a percentage sign after the number signifies a percentage Where either xs or ys is not specified the original dimension is assumed X1 and Y1 represent the upper left corner of the area to be scaled The default is the original image s upper left corner X2 and Y2 represent the lower right corner of the area to be scaled The default is the original image s lower right corner PreserveBackground when scaling an image that contains an object surrounded by a solid background color setting this parameter to true avoids anti aliasing the edge of the object with the background Anti aliasing is a method of eliminating jagged edges by blending pixel colors with the background When working with an object on a solid background however most users find it preferable to maintain a sharp clean edge because the blending can often produce an undesired halo effect PreserveBackgroundCutof f specifies the threshold for PreserveBackground The default threshold percentage is 67 which means that the background color will be preserved unless 67 or more of the pixels use the background color Padcolor or Padindex specifies the color to be used where the new image dimensions extend beyond the current image If a pad color is not specified the image s background color is used by default For more information about setting an image s background color see setColor Transparency specifies the transparency 255 is opaque and 0 is
40. changes the nature of the image data For example the color white on an RGB device is typically represented by setting all three channels to 255 However on a CMYK device white is typically represented by setting all four channels to 0 It is therefore important to know which colorspace an image is represented in Color Gamut Different devices may not be able to reproduce the same range of colors The range of colors that a given device can reproduce is called its gamut RGB devices typically have a significantly different gamut than CMYK devices Therefore converting an image from an RGB colorspace to a CMYK colorspace or vice versa typically involves a loss of information as different colors in the source colorspace may map to the same color in the destination colorspace For this reason it is advisable to keep the number of color conversions to a minimum Appendix B White Point Mapping The color considered to be white on each device may not be the same What is considered white for CMYK devices depends on the paper being used while white on a monitor depends on the maximum intensities of the red green and blue channels Typically monitors have a white that is noticeably bluer than paper However when an image displayed on the screen is printed one does not typically expect the image to be printed on a blue background Instead the white of the monitor is mapped to the white of the printe
41. in pixels of the effect NOTE The radius is actually square so a radius of two results in averaging over a 5x5 square centered on the given pixel MediaScript Objects and Methods 53 Example var image new Media image load name peppers tga image blur radius 12 image save type jpeg blurBlur Applies a similar but milder blur effect as the blur function NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax blurBlur Parameters There are no parameters for this function Example var image new Media image load name peppers tga image blurBlur image save type jpeg 54 Chapter 3 blurGaussianBlur Applies a Gaussian blur effect to the image NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax blurGaussianBlur Radius lt value 0 10 250 gt Parameters Radius specifies the extent of the effect The default is 1 00 Example var image new Media image load name peppers tga image blurGaussianBlur Radius 5 image save type jpeg blurMoreBlur Applies a similar but stronger bl
42. new Media image load name car tga image setColor backcolor OxC2270B image crop alg backcolor image save type jpeg compressed true setFrame Replaces the Media object for the specified frame if available Can be used with getFrame to modify an animation Syntax lt object name gt setFrame lt frame offset gt lt source Media object name gt i Parameters The frame offset starting from 1 specifies which frame in the target Media object gets replaced by the named source Media object which consists of a single frame Example var image new Media image load name Images clock gif Load an animated GIF with four frames image2 image getFrame 2 image2 flip axis Vertical image setFrame 2 image2 image save name newclock gif MediaScript Objects and Methods 133 134 Chapter 3 setLayer Replaces the Media object for the specified layer if available Used in conjunction with getLayer this is commonly used to modify layer contents before calling the collapse function Syntax lt object name gt setLayer lt layer index object name gt i Parameters The first parameter represents the layer index the first layer in a file is layer 0 The second parameter names the Media object that contains the data with which the layer is replaced Example var image new Media var Layer new Media Layer image getLayer 2
43. object The default value is 255 completely solid Unlock if set to true causes the rectangle to display only where the specified color value appears in the current background image The default is false Color sets the color of the rectangle Index colorizes the line using the available color palette from the source image as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index parameters Saturation specifies a value used for weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize PreserveAlpha if set to true preserves the alpha channel of the target image as the alpha channel of the resulting image The default is false Blend specifies the type of blending used to combine the drawn object with the images Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize causes only the hue component of the source to be st
44. setColor NOTE The Enlarge parameter has been deprecated layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 MediaScript Objects and Methods 75 76 Chapter 3 Opacity defines the level of transparency for the shadow The default opacity is 255 which is completely solid The shadow affects the alpha channel of the image as well as the visible channels Blur adds blurring that results in a shadow with a more diffused look Note however that the larger the blur value the more processing is required Dx and Dy specify the offset of the shadow from the original where positive values shift the shadow down and to the right Color specifies the color to be used for the shadow The default is the foreground color Index colorizes the image shadow using an available color palette for the source image as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index parameters Example var image new Media var image2 new Media image load name peppers tga image2 drawText font Arial style Bold text Fresh Peppers angle 30 color Ox00ccff size 36 smooth true baseline true kern true image2 dropShadow opacity 255 blur 2 dx 5 dy 15 color 0x000000 image composite source image2 image save type
45. specifies the desired layer index starting from zero If setLayerEnabled is set to true the layer is enabled if set to false the layer is disabled Example if image getLayerEnabled 2 false image setLayerEnabled 2 true se setLayerHandleX Sets the HandleX of the media layer with the specified index if available Syntax lt object name gt setLayerHandlex lt layer index gt lt position gt e Parameters The first parameter specifies the desired layer index starting from zero The second parameter sets the selected layer s attachment point on the x axis The default is Center Other options are Left and Right Example var image new Media image setLayerHandlexX 2 Right MediaScript Objects and Methods 135 136 Chapter 3 setLayerHandleY Sets the HandleY of the media layer with the specified index if available Syntax lt object name gt setLayerHandley lt layer index gt lt position gt Parameters The first parameter specifies the desired layer index starting from zero The second parameter sets the selected layer s attachment point on the x axis The default is Middle Other options are Top and Bottom Example var image new Media image setLayerHandleY 2 Bottom setLayerOpacity Sets the opacity of the media layer with the specified index if available Syntax lt object name gt setLayer
46. specifies the image to add by its user defined Media object name If you are adding an image that you have not yet loaded use the Name parameter to refer to that image by its name and extension such as airplane jpg Name if you or the administrator has set up virtual file systems you can use this parameter to add frames from that file system Virtual file systems are defined in the MediaRich server s local properties file See the MediaRich Administrator s Guide for more information For example if you define MyImages to represent the path C Images MyImages in the local properties file you can use files from the MyImages directory with the frameAdd function image frameAdd name MyImages split tga NOTE The Name parameter has been deprecated Duration specifies the frame duration in seconds This sets the duration of the frame in our internal structure Specifying this does not currently do anything useful Example var image new Media var image2 new Media image load name peppers tga image2 load name Bears tga image frameAdd Source image2 image reduce image save type gif getBitsPerSample Returns the number of bits per sample Syntax lt object name gt getBitsPerSample Parameters This function has no parameters Example if image getBitsPerSample 8 saa getBytesPerPixel Returns the number of bytes per pixel Syntax
47. tga Source load name logo tga Target composite source Source x 100 y 150 Target save type jpeg MediaScript Objects and Methods 65 66 Chapter 3 convert Converts the image to the specified type bit depth The 8 bit type is not supported since this involves a much more complex transformation palette selection etc instead use reduce When converting images with no alpha channel the generated alpha channel is based on the background color of the original if the background is set to transparent Otherwise the resulting alpha channel is solid white You can also use the setColor function placed before the convert function in the MediaScript to set the background color with Transparency set to true NOTE convert will convert between CMYK and CMYKA To convert CMYK color space to RGB color space and vice versa use colorCorrect Syntax convert RType lt bit depth gt Dither lt value 0 10 gt PreserveBackground lt true false gt layers lt layer list gt PSD files only pa Parameters Rtype specifies the target bit depth Supported bit depths are Gray 8 RGB 15 RGB 16 RGBA 16 RGB 18 RGB 24 RGBA 32 HSV 24 HLS 24 CMYK 32 and CMYKA 40 The 16 bit type is 5 6 5 while the 16a bit is 1 5 5 5 with the top bit as an alpha channel In addition the following shortcu
48. the flash energy Returns the spatial frequency response Returns the focal plane horizontal resolution Returns the focal plane vertical resolution MediaRich Metadata Support 179 getFocalPlaneResolutionUnit Returns the focal plane resolution unit getSubjectLocation Returns the subject location getExposurelIndex Returns the exposure index getSensingMethod Returns the sensing method getFileSource Returns the file source getSceneType Returns the scene type getCFAPattern Returns the CFA pattern 180 Appendix A Appendix B MediaRich Color Management MediaScript uses the ICC International Color Consortium methodology for color management where the color characteristics of each color reproduction device to be used is stored in a color profile This appendix explains the basics of color management and how to use MediaRich and the MediaScript scripting language to insure accurate RGB and CMYK color conversions Appendix Summary Color Management Overview 182 MediaScript Color Management Functions 184 Accuracy and Reversibility of Color Conversions 186 Common Color Management Questions 187 181 Color Management Overview 182 MediaScript uses the ICC International Color Consortium methodology for color management where the color characteristics of each color reproduction device to be used is stored in a color profile Converting an image from one device to another involves setting up a color tran
49. the weight thickness of the font Valid weight values in order of increasing thickness are e thin e extralight or ultralight e light e normal or regular e medium e semibold or demibold semi or demi are also acceptable e bold 72 Chapter 3 e extrabold or ultrabold extra or ultra are also acceptable e heavy or black Other Style parameter values are Underline Italic or Italics and Strikethru or Strikeout NOTE You can combine Style parameter values For example Style Bold Italic Text specifies the text to be drawn The text string must be enclosed in quotes To indicate a line break insert n into the text Color specifies the color to be used for the text The default value for text color is the image s foreground color For more information about setting an image s foreground color see setColor If a color palette is available for coloring the text you can use the Index parameter to colorize the image as an alternative to the Color parameter NOTE You cannot specify values for both the Colorand Index parameters Unlock specifies a color value that determines which pixels are displayed in the overlaid source image Using this parameter causes the selected foreground source image to display only where the specified color value appears in the curre
50. this mode replaces the preceding frame with the background color usually transparent when displaying the current frame e ManualUsePrev this mode restores the preceding frame before displaying the next frame NOTE If the original image has more than 256 colors you must apply the reduce function before the save function Additional Parameters for GIF and PNG Files Interlaced if set to true turns graphic interlacing on The default is false Additional Parameters for JPEG Files Quality sets the level of quality on a scale from 0 to 100 The default is 85 Progressive if set to true allows browsers to load the image in stages The default is false Baseline if set to true saves the JPEG using the optimized baseline format The default is false or the standard baseline format Colorspace specifies the colorspace format in which the JPEG is saved The default is Std Other valid colorspace format options are e Gray e RGB e YUV e CMYK e YCCK usually compresses better when saving CMYK data Highdetail if set to true improves overall image quality The default is false unless the Quality parameter is set to 100 in which case it is automatically enabled NOTE This option yields better results with drawings than photographs Dontoptimize disables the optimize feature of the JPEG writer The default is false Additional Parameter for PNG Fi
51. 312461 setStatusCode Sets the HTTP response status code The default is STATUS_OK 200 Syntax resp setStatusCode StatusCode Parameters statusCode an integer value for the HTTP response status The default is STATUS_OK 200 MediaScript Objects and Methods 41 42 Chapter 3 getStatusCode Returns the response status code Syntax var code resp getStatusCode Parameters This function has no parameters write Appends the specified text to the response object When you use this method you should set the mime type to the type of text written such as text plain text xml etc Syntax resp write This is the response resp setMimeType text plain Parameters The only parameter is the specified text string writeLine Appends the specified text to the response object and adds a new line When you use this method you should set the mime type to the type of text written such as text plain text xml etc Syntax resp writeLine This is the response with a newline resp setMimeType text plain Parameters The only parameter is the specified text string Media Object The Media object implements the many image processing features provided by MediaRich A typical script creates one or more Media objects by either loading image data from a file or using the Media drawing methods Class Methods There are static methods on the Media object They have been ad
52. BackgroundCutoff lt value 0 100 gt PadColor lt color in hexadecimal or rgb gt Padindex lt value 0 16777215 gt Transparency lt value 0 255 gt layers lt layer list gt PSD files only e Parameters Alg specifies the algorithm that will be used The default algorithm is fast The outline algorithm should be used for black and white images only Xs and Ys specify the destination size of the media The resulting image always fits these dimensions regardless of the scale and the source media X and Y specify the position of the top left corner of the region to be zoomed These coordinates are specified relative to the destination media at scale 1 Scale specifies a real value and gives the magnification of the resulting image For a value of 1 the whole media fits within the specified size PreserveBackground when scaling an image that contains an object surrounded by a solid background color setting this parameter to true avoids anti aliasing the edge of the object with the background Anti aliasing is a method of eliminating jagged edges by blending pixel colors with the background When working with an object on a solid background however most users find it preferable to maintain a sharp clean edge because the blending can often produce an undesired halo effect PreserveBackgroundCutof f specifies the threshold for PreserveBackground The default threshold percentag
53. FileParamPath Returns the path to the file associated with the specified file parameter name Syntax var myImageFile req getFileParamPath paramName Parameters paramName the name specified for the file parameter when it was set with the request MediaScript Objects and Methods 33 34 Chapter 3 Example Suppose that a file parameter is passed to a script with a parameter name of testFile This file can be accessed within a script as follows var path req getFileParamPath testFile var m new Media m load name path getHeaderNames Returns an array of all HTTP header names for the current request Syntax req getHeaderNames Parameters This function has no parameters Example function main var respText new TextResponse TextResponse TypePlain var headers req getHeaderNames for var i 0 i lt headers length i respText append headers i req getHeader headers i n resp setObject respText RespType Streamed Sample Output accept accept encoding gzip deflate accept language en us connection Keep Alive host localhost user agent Mozilla 4 0 compatible MSIE 6 0 Windows NT 5 1 Q312461 getRequestURL Returns the full MRL that originated the request Syntax var url req getRequestURL Parameters This function has no parameters getQueryString Re
54. HTML is disabled MediaRich will respond with a 500 Internal Server Error status code The File object provides access to an external file Object Methods new File constructor e clear e close e copy e exists getFileName e getFilePath getLastModified getLastAccessed e getParentPath getSize isDirectory e isFile e length e list e mkdir e read e readNextLine e remove rename e rmdir e write new File The File object needs to be constructed using the new File constructor Syntax var Test new File lt filename gt e Parameters filename specifies a string containing the filename and path with which the object is associated The default is an empty string The string must be in quotes If the string does not specify a file system the default is the write file system See File Systems on page 14 for more information clear Clears the contents of the file pointed to by the file object if the file already exists Syntax lt object name gt clear Parameters This function takes no parameters close Closes the file pointer and flushes any output immediately Syntax lt object name gt close Parameters This function takes no parameters MediaScript Objects and Methods 25 26 Chapter 3 copy Copies the File object to a new filename The object s
55. MediaRich uses white NOTE Using rectangle to mask frames within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the masking rectangle outside the loop MediaScript Objects and Methods 117 118 Chapter 3 Syntax rectangle X lt pixel gt Y lt pixel gt Xs lt pixel Ys lt pixel Opacity lt value 0 255 gt Unlock lt color in hexadecimal or rgb gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Saturation lt value 0 255 gt PreserveAlpha lt true false gt Blend lt blend type gt Width lt value gt Angle lt value 360 360 gt Smooth lt true false gt Fill lt true false gt Parameters X indicates in pixels the x axis coordinate of the upper left corner of the rectangle This parameter is required and has no default value Y indicates in pixels the y axis coordinate of the upper left corner of the rectangle This parameter is required and has no default value Xs indicates in pixels the x axis coordinate of the lower right corner of the rectangle relative to the upper left corner This parameter is required and has no default value Ys indicates in pixels the y axis coordinate of the lower right corner of the rectangle relative to the upper left corner This parameter is required and has no default value Opacity specifies opacity of the drawn
56. Opacity lt layer index gt lt value 0 255 gt Parameters The first parameter specifies the desired layer index starting from zero The second parameter specifies opacity of the selected layer with a value of 255 indicating completely solid Example var image new Media image setLayerOpacity 2 128 setLayerPixels Replaces the pixel data in a named layer of the target Media object with the pixel data from a layer in the source Media object Any attributes associated with the target layer are preserved Syntax lt object name gt setLayerPixels lt layer index gt lt Media object gt e Parameters The first parameter specifies the layer in the target image that gets its pixels replaced The default is the first layer starting from zero The second parameter specifies the source Media object Before you can use setLayerPixels you must load the source image If the source image has multiple layers the first one is used Example var Target new Media var Source new Media Target load name banner psd Source load name fishes psd Target setLayerPixels 3 Source Target save type jpeg setLayerX Sets the X composite offset of the media layer with the specified index if available Syntax lt object name gt setLayerx lt layer index gt lt position gt Parameters The first parameter specifies the desired layer index starting from ze
57. Streamed The response contents are set to the contents of the response object or file Since nothing is saved in the cache subsequent requests will re execute the script RespType Path This type applies to response files only The response is set to the full path of the file Again nothing is saved in the cache so subsequent request will re execute the script The Response Object does not need to be constructed A static global instance of each is created for each MediaScript execution context The resp object allows the user to set the Media response HTTP Request Object Properties This object has no properties HTTP Request Methods The req object includes the following methods e getParameter getParameterNames e getHeader getFileParamNames getFileParamPath getHeaderNames getQueryString getScriptPath e getRequestURL MediaScript Objects and Methods 31 getJobId e getBatchId getJobTempDir getBatchTempDir getParameter Returns the MRL parameter specified by name or null if no such parameter exists Syntax var paramValue req getParameter lt name gt Parameters name specifies the name of the MRL parameter to retrieve getParameterNames Returns an array of the names of all parameters specified on the MRL Syntax var nameArray req getParameterNames Parameters This function takes no parameters g
58. These lines are always preceded by a pound sign and are processed before the rest of the script and direct the way the script commands are interpreted These preprocessor directives extend only across a single line of code As soon as a newline character is found the preprocessor directive is considered to end No semicolon is expected at the end of a preprocessor directive The only way a preprocessor directive can extend through more than one line is by preceding the newline character at the end of the line by a backslash The following statements are collectively called preprocessor directives since they are processed before the rest of the script and direct the way the MediaScript commands are interpreted Using the include Directive The include directive is a preprocessing flag that is evaluated before the script is parsed or executed It allows other scripts to be included as if they were part of the original script and takes a string representing the relative path of the script filename to include The string must be enclosed in double quotes Syntax include lt relative path to the included file gt Example include process library ms If your MediaScript uses the XMLdocument object you need to use the include directive to specify the xm1 ms that installs with MediaRich Do this by adding the following line at the beginning of your script include sys xml ms Using the link Directive The lin
59. Zip myZip addFile images imagel jpg imagel jpg myZip addFile images image2 jpg image2 jpg myZip save zip files zip The Zip object can also be used as a response object For example the following code creates a zip archive as a cached response var myZip new Zip myZip addFile images imagel jpg imagel jpg myZip addFile images image2 jpg image2 jpg resp setObject myZip Unzip Object The Unzip object is used to extract files from an existing zip archive Unzip Profile Object Methods The Unzip Object implements the following methods e Unzip constructor e open e extractAll e firstFile nextFile e getFileName extractFile e close NOTE For all paths in the UnZip Object that do not specify a file system the default is the read file system See File Systems on page 14 for more information Unzip Constructor for Unzip object Parameters This function takes no parameters open Opens an existing archive The archive will remain open until one of the following occurs another archive is opened the archive is explicitly closed with the close method or the Unzip object is garbage collected Parameters archiveName specifies the path to the existing archive file extractAll Extracts all files in the zip archive to the specified directory The full paths stored in the archive will be preserved in the destination directory Paramete
60. aRich Color Management Example var image new Media image load name car jpg image colorCorrect destProfile SRGB icc image save type jpeg colorize Changes the hue of the pixels in the image to the specified color NOTE This function is selection aware and requires an active selection so that the system can apply colorize based on the current selection For more information about making selections see selection on page 129 Syntax colorize Color lt color in hexadecimal or rgb gt layers lt layer list gt PSD files only Parameters Color specifies the color using its hexadecimal or rgb value The best results will appear by creating or loading a selection first NOTE The extreme colors of solid black 0x000000 and solid white Oxfff f fL do not appear correctly when used for colorize It is recommended that instead you use 0x101010 and Oxe0e0e0 or less for black and white respectively Also totally saturated colors such as pure red can create unexpected results layers for PSD files specifies the layers to be colorized The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name car tga image selection name mskcar tga image colorize color 0x009900 image save type jpeg colorFromImage The specified color is con
61. alue ge ge tApertureValue tBrightnessValue tExposureBiasValue ge ge ge ge ge ge ge ge tMaxApertureValue tSubjectDistance tMeteringMode tLightSource tFlash tFocalLength tFNumber tLExposureProgram tSpectralSensitivity tISOSpeedRatings tOECF tFlashEnergy tSpatialFrequencyResponse tFocalPlaneXResolution tFocalPlaneYResolution Description Returns the width Returns the height Returns the ComponentsConfiguration value Returns the approx number of compressed bits per pixel Returns the name of a related sound file Returns a MediaScript Date object for the original date time Returns a MediaScript Date object for the digitized date time Returns the sub second time offset Returns the sub second time offset for the original Returns the digitized sub second time offset Returns the exposure time Returns the shutter speed in seconds Returns the aperture value as an F number Returns the brightness value Returns the exposure bias value Returns the maximum aperture value as an F number Returns the subject distance in meters Returns the metering mode Returns the light source Returns true if flash was used Returns the focal length Returns the F number Returns the exposure program Returns the spectral sensitivity Returns the ISO film speed Returns the OECF value Returns
62. amped down on the image and Prenormal NOTE Burn has been deprecated ColorBurn results in the same blend Width specifies the thickness in pixels of the line that describes the rectangle The default is 1 NOTE If the Fill parameter is set to true Width is ignored Smooth if set to true makes the edges of the rectangle smooth preventing a pixellated effect The default is false Fill fills in the rectangle with the color specified by the Color or Index parameter The default is false Example var image new Media image load name family2 jpg image rectangle x 45 y 55 xs 283 ys 157 width 3 image save type jpeg reduce Applies a specified or generated color palette to the image By default this function generates an optimal palette of 256 colors NOTE MediaRich also supports Adobe Color Table act files Syntax reduce Netscape lt true false gt BW lt true false gt LowMem lt true false gt Pad lt true false gt PreserveBackground lt true false gt NoWarp lt true false gt Name lt Palettes filename pal virtualfilesystem filename pal gt Colors lt 1 to 256 gt Dither lt value 0 10 gt DitherTop lt value 0 10 gt layers lt layer list gt PSD files only MediaScript Objects and Methods 119 120 Chapter 3 Parameters Netscape if set to true applies th
63. ample var image new Media var text new Media image makeCanvas Xs 200 Ys 150 FillColor Ox0000ff text makeText text hello world font Arial style Bold size 24 smooth true color Oxffffff image composite source text image save type jpeg hello world MediaScript Objects and Methods 105 106 Chapter 3 makeText This command instead of compositing text onto the target image creates a new image that includes just the text The image produced is always 32 bit This function fully supports the CMYK color space NOTE Using makeText within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the text object outside the loop Syntax makeText Font lt font family virtualfilesystem font family gt Style lt modifier gt Text lt string gt Color lt color in hexadecimal or rgb gt Rtype lt bit depth gt Size lt value 1 4095 gt Justify lt left center right justified gt Wrap lt pixel width gt Angle lt angle gt Smooth lt true false gt SmoothFactor lt 0 4 BaseLine lt true false gt Kern lt true false gt Line lt value 01 to 10 gt DPI lt resolution gt Fillcolor lt color in hexadecimal or rgb gt ClearType lt true false gt windows only FitText lt true false gt 3 Parameters Font specifies the TrueTyp
64. amut colors This is usually the best rendering intent for complex images such as photographic images Relative Colorimetric This intent specifies that colors that lie inside the common color gamut of both devices be reproduced exactly Colors that are outside of the destination devices color gamut are mapped to the gamut boundary This means that many out of gamut colors may be MediaRich Color Management 183 mapped to the same color on the destination device This intent is useful when it is known that the colors in the image mainly lie inside the gamut of both the source and the destination device Absolute Colorimetric This intent is used when you want the colors on the destination device to be colorimetrically equal to that on the source device No white point mapping is done This intent is rarely used for image processing Saturation For certain types of images notably business graphics it is more important to preserve the saturation of the color than the color itself The saturation intent is provided to handle this case MediaScript Color Management Functions 184 The color management functions provided by MediaScript can be divided into two categories e image conversion e profile management The image conversion functions are all members of the Media object while the profile management functions are provided by the IccProfile object A brief overview of these functions is provided here Image Conversion Met
65. an not be specified in a virtual file path in a URL Another reason to define additional filesystem would be to associate different user names and passwords with each filesystem or to differ the caching behavior between filesystems To define a HTTP filesystem only the Specifier property is required The following is an example that defines a new HTTP filesystem named media and sets the default user info for that filesystem filesystem fsnet media Specifier media filesystem fsnet media UserNameAndPassword joeblow tokyo A file path to a resource on this filesystem would look like this media www apple com images applelogo jpg To define a FTP filesystem the Ftp property must be specified to indicate that the filesystem will utilize the FTP protocol The following is an example that defines a new FTP filesystem named bar that has caching disabled filesystem fsnet bar Specifier bar filesystem fsnet bar Ftp 1 filesystem fsnet bar RefreshInterval 1 The name of the filesystem as specified after the fsnet portion of property name need not match the value of the Specifier property The filesystem name is used to refer to the filesystem in the properties file The Specifier defines what word appears at the front of a virtual file path to indicate that filesystem By convention and for clarity these two values should always be the same Configuring the FSNet File Systems The FTP and HTTP file system
66. and Technologies It is highly suggested that you ensure that there are back up copies of these files before you modify either of them Programming MediaRich for SharePoint 7 8 Chapter 1 Using the processImage Function The MediaScript API for SharePoint is comprised of a single function your script must define This enables the script to function correctly both as an Export script and a MediaCart script In the case of the MediaCart the same script is used for each image in a MediaCart batch Syntax Media processImage Media image The process Image function is the single entry point for all scripts that interoperate with the MediaRich for SharePoint Connector Parameters The process Image function takes a Media object as its single argument This object is an image from a Windows SharePoint Services site on which operations are performed Return Your processImage function must return a Media object Example The following sample script named save image as jpg ms specifies that an arbitrary input image should be saved using the JPG file format function processImage image var saveParams resp getSaveParameters saveParams type jpg resp setSaveParameters saveParams return image The first line function processImage image starts the definition of the processImage function It is expecting to be passed a Media object named image This script requires a little more info
67. arameters setMimeType Sets the response MIME type Syntax resp setMimeType text xml Parameters mimeType specifies the type of response The default type depends on the response type e For files it is determined automatically based on the file extension e For object responses it is based on the value returned by the MR_save method of the object getMimeType Returns the response MIME type or if not set undefined Syntax var mimeType req getMimeType Parameters This function has no parameters setHeader Sets a HTTP response header with the given name value pair Syntax resp setHeader name value Parameters name the string name indicating the HTTP header value the string value of the HTTP header getHeader Returns the value for the given HTTP header name Syntax req getHeader lt name gt i Parameters The only parameter is the specified header name Example function main var respText new TextResponse TextResponse TypePlain var headers req getHeaderNames for var i 0 i lt headers length i respText append headers i req getHeader headers i n resp setObject respText RespType Streamed Sample output accept accept encoding gzip deflate accept language en us connection Keep Alive host localhost user agent Mozilla 4 0 compatible MSIE 6 0 Windows NT 5 1 Q
68. ates a blank Media object of the specified dimensions and fully supports the CMYK color space Syntax makeCanvas Xs lt width in pixels gt Ys lt height in pixels gt Rtype lt bit depth gt FillColor lt color in hexadecimal or rgb gt Transparency lt true false gt Parameters Xs and Ys specify the width and height of the canvas in pixels If Xs or Ys is not specified a 1x1 canvas is created If only one of Xs and Ys is specified the unspecified parameter is assumed to be the same as the specified one a square canvas is created Rt ype specifies the bit depth Supported bit depths are RGB 24 RGBA 32 CMYK 32 CMYKA 40 Gray 8 RGB 15 RGB 16 RGBA 16 RGB 18 Alpha 8 HLS 24 and HSV 24 The default bit depth is RGBA 32 RGB 32 bit NOTE The 16 bit type is 5 6 5 while the 16a bit is 1 5 5 5 with the top bit as an alpha channel FillColor determines the color value given to each pixel in the generated canvas If FillColor is not specified each pixel is set to black Transparency set to true the canvas pixels are all set as transparent and FillColor is used as both the foreground and background color If Transparency is set to false the canvas pixels are set as solid Fil1Color is used for the foreground color and the background color is black Transparency is set to false by default Ex
69. ation is case sensitive Example To access the LogLevel property in the local properties files getPropertyValue local LogLevel The local properties file includes the following line LogLevel error So get PropertyValue returns error getScriptFileName Returns the current filename for this running script Syntax getScriptFileName print Depending on the platform prints the specified string to the command prompt MS Windows or to MediaScript log Mac OS Syntax print lt string gt rgb Converts the three supplied RGB color values into a 24 bit value 0 16 777 215 that is suitable for many Media graphic operation arguments Syntax rgb lt red gt lt green gt lt blue gt RgbColor Object This object is constructed from a 24 bit value It splits the color into red green and blue components Constructor RgbColor value returns an RgbColor object constructed from value Properties ced the red component read or write Valid values range from 0 to 255 green the green component read or write Valid values range from 0 to 255 blue the blue component read or write Valid values range from 0 to 255 Methods valueOf converts the red green and blue components back to a 24 bit value toString returns string representation of 24 bit value Functions RgbColorFromRGB red green blue constructs RgbColor from the components
70. ault is 3 Angle specifies the angle of the light source The default is 135 light source comes from the upper left Amount specifies the extent of the effect the higher the value the greater the detail The default is 100 Example var image new Media image load name peppers tga image stylizeEmboss Height 2 Angle 90 Amount 250 image save type jpeg stylizeFindEdges Traces the edges areas of significant transitions of the image with broad lines NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax stylizeFindEdges Threshold lt value 0 255 gt Grayscale lt true false gt Mono lt true false gt Invert lt true false gt Parameters Threshold specifies how sharp an edge must be to included The default is 0 Grayscale produces a monochromatic result The default is false Mono when set to true causes all edges above the threshold value to default to 255 The default is false Invert reverses the default foreground and background colors The default is false Example var image new Media image load name peppers tga image stylizeFindEdges Threshold 125 Grayscale true Mono true Invert true image save type jpeg sty
71. ayers that begin with a lowercase b NOTE All Photoshop Adjustment Layers must be merged into the layer image data prior to use in MediaRich VisibleOn1ly when set to true and loading photoshop layers collapsed is set to false only the layers designated as visible are loaded The default is false PreviewAlpha when set to false and layers are not specified the loaded image s preview will not contain the preview alpha channel Parameters for FPX Files transform when set to true performs any transformations that are embedded in the FPX file The default is false Parameters for PNG Files fillalpha when set to true fills transparent and translucent pixels with the image s background color The default is false screengamma specifies a floating gamma point causing the reader to perform a gamma correction if the file contains a specified gamma value The default is 0 no correction Parameter for WBMP Files waplook when set to true sets the image s palette to simulate the look of an LCD screen on an actual WAP device Example var image new Media image load name peppers tga type targa image save type jpeg MediaScript Objects and Methods 103 104 Chapter 3 loadAsRgb The loadAsRgb function is an add on to the Media object that acts exactly like Load does when an RGB file is read When a CMYK file is read the images in the file are
72. ays after loading The default is 0 infinite looping Removeduplicates if set to true causes the GIF writer to remove duplicate frames and combine their delay times into a single frame The default is false Delay sets the delay time in hundredths of a second for all frames in the GIF overriding any values that are stored in each frame DisposalMethod indicates the mode of compression used when saving the GIF The possible modes are e Auto this is the default behavior if no option is specified It determines the best compression using all of the GIF specification features e Compatible this mode sets compatibility for Netscape and Opera browsers The GIF writer still automatically calculates delta rectangles for each frame and does transparent color compression but replaces any restore to previous instructions in the GIF with restore with background NOTE The Compatible mode may result in a less efficient GIF depending on how the pixels are laid out in each frame There will be no difference if the GIF is not animated and has no transparent areas that are visible down to the browser s background MediaScript Objects and Methods 125 e ManualUnspecified this mode disables any compression to allow compatibility with any applications that do properly follow the GIF specification e ManualLeave this mode prevents the disposal of the preceding frame when displaying the current frame e ManualUseBG
73. c saveObj name newFile metaObj save saveObj If any of the exif iptc or xmp parameters are omitted existing metadata of that type in the file will be transferred to the output file If any of the exif iptc or xmp parameters are specified as null existing metadata of that type will be omitted in the output Otherwise IPTC and XMP data will be replaced with the specified data and writable Exif tags will be replaced The Exif camera data tags are never replaced MediaRich Metadata Support 171 High Level Support for Exif and IPTC 172 Two MediaScript objects are provided to simplify the tasks of getting and setting individual metadata items These objects are provided to support IPTC and Exif metadata Each of these objects has a similar format providing set lt Tag gt methods and get lt Tag gt methods which set and get individual metadata fields respectively lt Tag gt represents the name of the metadata tag to set or get The following section describes the general structure and common methods for both the IPTCMetadata object and the ExifMetadata object This is followed by descriptions of the set lt Tag gt and get lt Tag gt methods for the IPTCMetadata and ExifMetadata objects Common Metadata Methods The IPTCMetadata and ExifMetadata objects have several common methods allowing the scripter to create documents specify metadata for existing documents extract a string representation of the XML document and va
74. ce image you can use the Index parameter to set the color of the polygon as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index fields Saturation specifies the value used for weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize PreserveAlpha if set to true preserves the alpha channel of the target image as the alpha channel of the resulting image The default is false Blend specifies the type of blending used to combine the drawn object with the images Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize causes only the hue component of the source to be stamped down on the image and Prenormal NOTE Burn has been deprecated ColorBurn results in the same blend MediaScript Objects and Methods 115 Width specifies the thickness in pixels of the line that describes the polygon The default is 1 NOTE
75. cent descent the font descent height the font height averageWidth the average character width maxWidth the maximum character width weight the font weight italic returns 1 if italic underlined returns 1 if underlined strikeout returns 1 if strikeout overhang extra width that may be added to some fonts by GDI Parameters font specifies the TrueType or PostScript font family name to be used for example Arial For more information about how MediaRich methods work with fonts and font files see the drawText on page 71 size sets the point size of the font to be used The default size is 12 style specifies the font style You can use any combination of modifiers Each modifier should be separated by a space character NOTE The Style parameter is not available if MediaRich is running on Mac Linux or Solaris Weight modifiers modify the weight thickness of the font Valid weight values in order of increasing thickness are e thin e extralight or ultralight e light e normal or regular e medium e semibold or demibold semi or demi are also acceptable e bold e extrabold or ultrabold extra or ultra are also acceptable e heavy or black Other Style parameter values are Underline Italic or Italics and Strikethru or Strikeout NOTE
76. converted to RGB This function is defined in Sys media ms Syntax loadAsRgb name lt filename gt type lt typename gt detect lt true false gt transform lt true false gt FPX files only layers lt layer list gt PSD files only fillalpha lt true false gt PNG files only screengamma lt value 0 10 gt PNG files only waplook lt true false gt WBMP files only dpi lt value 1 32767 gt EPS PDF and PS files only sourceProfile lt filename icc gt destProfile lt filename icc gt intent lt rendering intent gt overrideEmbedded lt true false gt Parameters name type detect transform layers fillalpha screengamma waplook and dpi these parameters operate the same as for the 1oad function For more information see load on page 101 sourceProfile destProfile intent andoverrideEmbedded used to determine how this conversion is performed If any of these parameters are not supplied the current defaults as specified in the properties file are used instead NOTE If the dest Profile parameter is specified the resulting image will be in the colorspace of the specified profile If this profile does not have an RGB colorspace the resulting image will NOT be an RGB image Example include Sys media ms var image new Media image loadAsRgb name myCmykImage tif makeCanvas This function cre
77. d with an additional backslash Before you can use the new file system aliases you must restart the MediaGenerator service The corresponding load and save operations would look like image load name retailIN camera psd image save name retailOUT camera jpg File Filesystem The file filesystem allows standard file URLs to be supplied to MediaScript functions that take filenames This filesystem allows access to any file on the MediaRich server including files available via UNC paths files on the network Because this filesystem allows such broad access to resources it is read only and disabled by default To enable the filesystem add the following line to the local properties file filesystem file enabled tru To make the filesystem writable add the following line filesystem file writeable tru Examples var image new Media image load name file C Documents and Settings All Users Documents My Pictures Sample Pictures Sunset jpg var image2 new Media image2 load name file eqfileserv home eng testbed images tif 32bit tif HTTP Support Using the FSNet Plug in The FSNet plug in can implement HTTP and FTP access via standard URLs by defining virtual filesystems named http and ftp FSNet and MediaRich Virtual Filesystems MediaRich accesses files by defining a number of virtual filesystems A virtual file system indicates the root of a file t
78. ded to the Media class and include e getFileInfo e getFileFormats e getExtensionFromType getTypeFromExtension getFilelInfo The method returns data about the image or images contained in the specified file It returns as much information as can be ascertained without considerable processing time It is left for the implementor of each file format handler to determine what considerable processing time means but what is normally returned is that information that can be obtained by reading a small portion 1 2K of the file The data is returned as a JavaScript object where each value returned is a property of that object The information returned by this method will vary from one file type to another The only value that is guaranteed to be returned is the Type value The Type value is the name of the file type of the file such as tiff jpeg etc szy 3 n The following values are returned by most file types current exceptions are ai pct it AF ps eps and pdf files e Width the width of the image s contained in the file e Height the height of the image s contained in the file e Format the pixel format of the image s contained in the file Other values that are returned by some file types are e XDpi the horizontal resolution of the image s e YDpi the vertical resolution of the image s e Frames the number of frames in the f
79. description of each Exif metadata field please consult the Exif metadata specification available at http www exif org NOTE Where possible the values listed in the following tables are converted into string valued representations as defined in the exif specification IFDO Methods Method getImageDescription setImageDescription string getOrientation setOrientation string getSoftware setSoftware string getArtist setArtist string getDateTime Description Returns the image description Sets the image description Returns the image orientation Set the image orientation Returns the software description Sets the software description Returns the artist Sets the artist Returns the DateTime field as a MediaScript Date object MediaRich Metadata Support 177 178 Method S tDateTime date ge se ge se ge ge ge tPhotographerCopyright tPhotographerCopyright string tEditorCopyright tEditorCopyright string tMake tModel tImageWidth tImageLength ge ge ge ge ge ge ge ge ge tBitsPerSample tCompression tPhotometricInterpretation tPlanarConfiguration tYCbCrSubSampling tYCbCrPositioning tXResolution tYResolution tResolutionunit tWhitePoint tPrimaryChromaticities tYCbCrCoefficients tReferenceBlackWhite IFDExif Methods Method ge se ge se ge se
80. dia object and the _MR_Metadata object The Media object provides support for loading and saving metadata along with the image contents The _MR_Metadata object provides support for loading and merging just the metadata contained within the files without loading the image data This allows the scripter to modify the metadata within compressed files without decompressing and recompressing the image data The Media Object The load command of the Media object will load and attach Exif IPTC and XMP metadata if the loadMetadata parameter to the load command is specified as true For example var image new Media image load name myimage jpg loadMetadata true This constructs an XML document for any Exif IPTC or XMP metadata contained in the file and attach it to the Media object This metadata can be accessed by the scripter using the getMetadata command of the Media object var metaDoc image getMetadata IPTC This metadata document can be processed and edited To modify the metadata attached to the image use the setMetadata method image setMetadata Exif myExifData Finally use the save method to save any metadata attached to the document unless the SaveMetadata parameter is set to false image save type jpeg The metadata names for use with the getMetadata and setMetadata methods are Exif IPTC and XMP for the Exif IPTC and XMP metadata documents re
81. diaRich A typical script creates one or more Media objects by either loading image data from a file or using the Media drawing methods The script then performs additional image processing operations based on arguments and parameters in the request Finally the script generates a response by saving a Media object to the desired output file format This scripting framework provides a few key services e Loads the image that will be passed to a processImage function e Calls the processImage function e Saves the image returned from the process Image function Additional steps are performed depending on whether the context is Export or the MediaCart Because this framework is provided as MediaScript it is readily modifiable However this requires advanced understanding of MediaScript Before modifying the framework you should have some real experience writing MediaScript read and understand the information about using MediaScript in general and in particular the sections on Media object the Request object the response object and the TextResponse object There are separate scripts used to provide the framework for Export and the MediaCart For Export MediaRich Root Shared Originals Scripts SharePoint exportCrop ms For the MediaCart MediaRich Root Shared Originals Scripts SharePoint MRBatch ms NOTE These scripts are critical for users to be able to use the Document Export and MediaRich MediaCart site with SharePoint Products
82. e function Syntax lt object name gt getLayeryY lt layer index gt i Parameters layer index specifies the desired layer index starting from 0 Example var image new Media image load name peppers psd if image getLayerY 2 25 sis getMetaData Returns a metadata string of the specified format associated with a Media object MediaRich allows users to assign arbitrary key value pairs to any Media object using the setMetaData function The getMetaData function returns the value as a string Syntax var xmlDoc lt object name gt getMetadata lt format gt Parameters The specified format is the key of the key value pair Valid values are Exif IPTC or XMP Example var image new Media image load name peppers psd image getMetaData Exif core getPalette Returns an array of integers containing the colors in the palette or null if the image does not have a palette The RGB components of these colors can be obtained using the RGBColor object defined in sys color ms If the image has no palette the array is empty Syntax palColors lt object name gt getPalette Parameters This function has no parameters MediaScript Objects and Methods 89 Example include sys color ms var colors media getPalette if colors length gt 1 var rgb new RGBColor colors 0 print red is rgb red getPaletteS
83. e The default is zero which is no dithering While the dither value ranges from 0 to 10 the actual effects of different values vary according to the number of colors in the palette and their spread relative to each other Dithertop if set to true when dithering is used sets an upper threshold of how far the dithering algorithm will go to pick a color in order to correct color balance The default value is 10 When an optimal custom palette is used lowering the value of dithertop tends to reduce the pixelization of the image making the dithering effect softer layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name car tga image reduce colors 256 dither 3 pad true image save type jpeg MediaScript Objects and Methods 121 122 Chapter 3 rotate Rotates the media by the specified angle in degrees This function fully supports the CMYK color space Syntax rotate Angle lt value 0 to infinity gt ResizeCanvas lt true false gt Smooth lt true false gt Xs lt pixels gt Ys lt pixels gt layers lt layer list gt PSD files only Parameters Angle specifies the number of degrees the image will be rotated Positive numbers rotate clockwise and negative numbers rotate counter clockwise Resiz
84. e Netscape default palette as an alternative to applying the default custom palette BW if set to true applies the two color black and white palette Pad ensures that the palette always contains the required number of colors In a situation where there are fewer unique colors in the image than required for the palette the extra colors are padded with black If pad is not specified the palette will shrink down to the number of unique colors available PreserveBackground when dithering is used eliminates any pixels in the source image that match the background color from the dithering process in the destination image This can be used to eliminate fuzzy edges for an object against a solid color background Nowarp if set to true turns off the normal color space warping that occurs when searching for a closest color to take into account the bias in the human eye This is useful when reducing an image to an existing palette with a small number of colors such as the Windows 16 color palette Name specifies a palette file as the palette to be applied to the image The following color palette files are installed on MediaRich e 128 Grays pal e 16 Grays pal e 256 Grays pal e 32 Grays pal e 4 Grays pal e 64 Grays pal e 8 Grays pal e Macintosh 16 pal e Macintosh 256 pal e Netscape pal e Windows 16 pal e Windows 256 pal The default location for palette files is MediaRich Shared Ori
85. e colorCorrect destProfile sSRGB icc eas equalize Equalizes the relevant components of the media Equalization takes the used range of a component and expands it to fill the available range This can be applied to both indexed and non indexed images NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection Syntax equalize Brightness lt 1 00 to 20 00 gt Saturation lt 1 00 to 20 00 gt e Parameters Brightness and Saturation specify values that are given in terms of clip value Clip value is the percentage of pixels that can lie outside the measured range before expansion and whose value is therefore clipped in the process The valid values are 0 to 20 and 1 although values between 0 5 and 1 0 generally produce the most favorable results NOTE As a special case specifying a clip value of 1 applies histogram equalization to that channel Histogram equalization is a much harsher method but effectively maximizes the amount of visible information in an image Example var image new Media image load name car tga image equalize brightness 10 saturation 5 image save type jpeg exportChannel Exports a single channel of the source as a grayscale image This function fully supports the CMYK color space NOTE This function was f
86. e is 67 which means that the background color will be preserved unless 67 or more of the pixels use the background color Padcolor or Padindex specifies the color to be used where the new image dimensions extend beyond the current image If a pad color is not specified the image s background color is used by default For more information about setting an image s background color see setColor Transparency specifies the transparency 255 is opaque and 0 is transparent of the padded area s alpha channel This parameter is useful when the cropped image is used in a composite NOTE If the cropped image is not 32 bit before cropping the transparency information is not used on the next composite function layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name pasta tga image zoom xs 100 ys 100 scale 2 x 20 y 30 image save name Result tga MediaScript Objects and Methods 149 XmIDocument Object 150 Chapter 3 Mediakich allows users to interact with XML documents and supports all the objects properties and methods of the Document Object Model DOM Level 1 Core The DOM Core is an application programming interface for XML documents For information on using the DOM Level 1 Core objects properties and methods see http
87. e of the line start point This parameter is required and has no default value X2 indicates in pixels the x axis coordinate of the line end point This parameter is required and has no default value Y2 indicates in pixels the y axis coordinate of the line end point This parameter is required and has no default value MediaScript Objects and Methods 99 100 Chapter 3 Opacity specifies opacity of the drawn object The default value is 255 completely solid Unlock if set to true causes the line to display only where the specified color value appears in the current background image The default is false Color specifies the color of the line Index colorizes the line using the available color palette from the source image as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index parameters Saturation specifies a value used for weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize PreserveAlpha when set to true preserves the alpha channel of the target image as the alpha channel of the resulting image The default is false Blend specifies
88. e or PostScript font family to be used for example Arial MediaRich supports Type 1 pfa and pfb PostScript fonts only NOTE The size of the font in pixels is dependent on the resolution of the resulting image If the resolution of the image is not set zero the function uses a default value of 72 dpi The default location for fonts specified in a MediaScript is the fonts file system Which includes both the MediaRich Shared Originals Fonts folder and the default system fonts folder If a MediaScript specifies an unavailable font MediaRich generates an error NOTE You can modify the MediaRich server s local properties file to change the default fonts directory See the MediaRich Administrator s Guide for more information Style specifies the font style You can use any combination of modifiers Each modifier should be separated by a space character NOTE The Style parameter is not available if MediaRich is running on Mac Linux or Solaris Weight modifiers modify the weight thickness of the font Valid weight values in order of increasing thickness are e thin e extralight or ultralight e light e normal or regular e medium e semibold or demibold semi or demi are also acceptable e bold e extrabold or ultrabold extra or ultra are also acceptable e heavy or black Other Style parameters are Und
89. e under the keys ColorManager DefaultRGBProfile and ColorManager DefaultCMYKProfile respectively Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile link IccProfile dll var prof new IccProfile USWebCoatedSWOP icc var image new Media image load name fileWithEmbeddedProfile jpg var prof2 new IccProfile image getName Returns the friendly display name of the profile Parameters This function takes no parameters Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile and gets the friendly name link IccProfile dll var prof new IccProfile USWebCoatedSWOP icc var name prof getName getPath Returns the path of the profile file Parameters This method has no parameters Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile and gets the profile path link IccProfile dll var prof new IccProfile USWebCoatedSWOP icc var name prof getPath getClass Returns the profile class Parameters This method has no parameters MediaScript Objects and Methods 157 158 Chapter 3 Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile and tests if it is a printer profile link IccProfile dll var prof new IccProfile USWebCoat
90. e when the length is not known either of the following will work e frames 1 0 e frames 1 999999 assuming there aren t more than 999999 pages Frames can also select some subset of all pages in the file and a single frame may also be specified In addition frame is a valid alias for frames Any of the following are valid e frames 3 9 e frames 7 e frame 12 e frame 4 9 Intermediate File Specification Instead of rendering pages into the source Media you can use the load function to render eps pdf ps ai files into a multi frame TIFF file This method avoids having to read an entire multi page file into memory at once temporaryFileName specifies the TIFF file to render into and specifies that file not be deleted after the operation completes The normal load operation is not otherwise affected so pages may still be rendered into the source Media as well If the user wishes to not render any pages into the source Media they can specify that only frame 0 zero be rendered The following is an example of how to render into a TIFF file without adding any frames to the Media img load name anImage ps temporaryFileName foo tif frame 0 NOTE You will get an error message if you try to load a Photoshop image that includes an adjustment layer Additional Parameters for Photoshop Files When loading a Photoshop file MediaRich by default loads a single raster created by the Ph
91. eCanvas provides for the canvas of the image to be automatically enlarged in order to encompass the rotated image The additional area uses the image s background color For more information about setting an image s background color see setColor NOTE The Enlarge parameter has been deprecated Smooth provides for smooth edges when rotating to something other than right angles Xs and Ys specify how the image will be cropped after it is rotated layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name pasta tga image rotate angle 45 smooth true image save type jpeg rotate3d Rotates the image in 3D along either the x axis or y axis A positive angle rotates away from the viewer about the top or left edge a negative angle rotates away from the viewer about the bottom or right edge This function fully supports media objects within the CMYK color space Syntax rotate3d alg lt Fast Smooth Best gt anglex lt angle 89 gt angley lt angle 89 gt distance lt value gt layers lt layer list gt PSD files only 3 Parameters alg specifies the algorithm that will be used The default algorithm is fast The effect of the best algorithm is most apparent when scaling upward it uses a spline algorithm g
92. edSWOP icc var isPrinter prof getClass amp IccProfile PRINTER getColorspace Returns the profile colorpace Parameters This function takes no parameters Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile and tests if it is a CMYK profile link IccProfile dll var prof new IccProfile USWebCoatedSWOP icc var isCmyk prof getColorspace amp IccProfle CMYK getConnectionspace Returns the Profile connection space as the jseNumber Parameters This function takes no parameters Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile and gets the connectionspace link IccProfile dll var prof new IccProfile USWebCoatedSWOP icc var connectionspace prof getConnectionspace close Closes profile file Returns no value Parameters This function takes no parameters Example The following code creates an IccProfile object using the USWebCoatedSWOP icc profile and then closes the file link IccProfile dll var prof new IccProfile USWebCoatedSWOP icc prof close IccProfile dll The following code returns text describing every available CMYK profile link IccProfile dll include sys TextResponse ms function main var txt new TextResponse var profs IccProfile list IccProfile CMYK IccProfile UNKNOWN for
93. efault value for color is the image s foreground color For more information about setting an image s foreground color see setColor on page 131 layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background For more information see load on page 101 The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution including the CMYK color space MediaRich uses white Example Image new Media FindColor 0x000000 MakeColor Oxff00ff Image load name image 32bit psd Rows Image getWidth Columns Image getHeight for x 0 x lt Rows x t for y 0 y lt Columns y t MediaScript Objects and Methods 139 140 Chapter 3 if Image getPixel x x y y FindColor Image setPixel x x y y rgb MakeColor Image save type jpeg setResolution Changes the DPI of the image in memory and fully supports media objects within the CMYK color space NOTE This information can be stored only in the following formats BMP GIF JPEG PCT PCX PNG PSD and TIFF Sy
94. en I try to construct an IccProfile object get the Nota function type error What s wrong The IccProfile object is a MediaScript link object To use the IccProfile object when MediaRich is installed on a Windows server type the following line at the beginning of your script link lt IccProfile dll gt MediaRich Color Management 187 188 What s the best method for color correcting a Grayscale image To maintain compatibility with previous versions of MediaRich Grayscale images may be treated in the same manner as RGB images However this assumes that the default RGB colorspace uses equal amounts of red green and blue to represent gray and that the transform from Grayscale to RGB is linear If a profile is available for your Grayscale images better results will be obtained by using the Grayscale profile to color correct the Grayscale image to RGB before processing it as an RGB image How do I treat all images as RGB images If you are not concerned about precise color conversions the loadAsRGB method has been provided as an add on to the media object in the file Scripts Sys media ms This method loads an image and if the image colorspace is not RGB it converts the image to RGB using the embedded profile default source and destination profiles defined in the global properties file If the image has an embedded profile it is used as the source Here is an example of how to use the loadAsRGB method include
95. enhancements This chapter only describes those features unique to MediaScript for a detailed description of the basic language see the ECMAScript Language Specification available at http www ecma ch ecmal STAND ECMA 262 htm or one of the many available JavaScript references Chapter Summary The Media Object 12 Preprocessor Directives 12 Named Arguments 13 File Systems 14 11 The Media Object The most important built in object in MediaScript is the Media object which implements the many image processing features provided by MediaRich A typical script creates one or more Media objects by either loading image data from a file or using the Media drawing methods The script then performs additional image processing operations based on arguments and parameters in the request Finally the script generates a response by saving a Media object to the desired output file format For example a script to scale an image might look like the following function main imageName width height var img new Media img load name imageName img scale xs width ys height alg best img save type jpeg For a complete description of all of the methods provided by the Media object see Chapter 3 MediaScript Objects and Methods Preprocessor Directives 12 Chapter 2 Preprocessor directives are lines included in the code of our programs that are not program statements but directives for the preprocessor
96. enter point of the ellipse This parameter is required and has no default value Rx specifies in pixels the radius of the ellipse on the x axis This parameter is required and has no default value Ry specifies in pixels the radius of the ellipse on the y axis This parameter is required and has no default value Opacity specifies opacity of the drawn object The default value is 255 completely solid Unlock if set to true causes the ellipse to display only where the specified color value appears in the current background image The default is false Color specifies the color to be used for the ellipse The default is the foreground color Index colorizes the ellipse using the available color palette for the source image as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index parameters Saturation specifies a value used for weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize MediaScript Objects and Methods 77 78 Chapter 3 PreserveAlpha if set to true preserves the alpha channel of the target image as the alpha channel of the resulting image The defau
97. eparate storage and an external mechanism is used to duplicate and synchronize originals across all of the servers In either case as a script developer you can write your scripts once without worrying about the details of each server s file system layout File System Specifiers In order to abstract file system access all paths in MediaScript can be prefixed by a file system specifier of the form specifier path Specifiers must consist entirely of alphabetical characters numbers and punctuation marks are not allowed Most file system specifiers are simply aliases for local or shared directories The following table lists these specifiers File System Specifier Default Location cache MediaRich Shared Generated MediaCache fonts MediaRich Shared Originals Fonts logs MediaRich Shared Logs output MediaRich Shared Generated File System Specifier Default Location profiles MediaRich Shared Originals Profiles read MediaRich Shared Originals Media results MediaRich Shared Generated MediaResults scripts MediaRich Shared Originals Scripts sys MediaRich Shared Originals Sys write MediaRich Shared Originals Media All MediaScript operations that take a path default to a reasonable file system when no specifier is present in the path The following table lists these defaults MediaScript Operation Default File System Specifier Loading a script scripts Loading a color management profile prof
98. erline Italic or Italics and Strikethru or Strikeout NOTE You can combine Style parameters as necessary For example Style Bold Italic Text specifies the text to be drawn The text string must be enclosed in quotes To indicate a line break use n Color specifies the color to be used for the text The default value for text color is white For more information about setting a foreground color see setColor on page 131 Rt ype specifies the target bit depth Supported bit depths are Gray 8 RGB 15 RGB 16 RGBA 16 RGB 18 RGB 24 RGBA 32 HSV 24 HLS 24 CMYK 32 CMYKA 40 The 16 bit type is 5 6 5 while the 16a bit is 1 5 5 5 with the top bit as an alpha channel In addition the following shortcuts will have default values when used as input parameters e Gray gt Gray 8 RGB gt RGB 24 e RGBA gt RGBA 32 e HSV gt HSV 24 e HLS gt HLS 24 e CMYK gt CMYK 32 e CMYKA gt CMYKA 40 NOTE Deprecated Rtype values include Grayscale 15 bit 16 bit 16a bit 24 bit 32 bit Size sets the point size of the font to be used and its default value is 12 and the maximum is 4095 Justify specifies how the text will be justified The default is center Other options are left right hand and justified The justified option is availab
99. es only the hue component of the source to be stamped down on the image and Prenormal This function supports CMYK for the following blend modes Normal Darken Lighten Screen Multiply Dissolve Overlay HardLight SoftLight Difference Exclusion Burn Dodge Under Copy and PreNormal The other modes Hue Saturation Color Luminosity and Colorize are not supported for CMYK You must first convert to RGB using colorCorrect and then perform the composite Additionally composite cannot be performed unless both images are either CMYK or RGB layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 importChannel Imports the specified source image treated as a grayscale and replaces the selected channel in the original It is important that both images must be the same size Before you can import an image you must load it NOTE This function was formerly named importGun which has been deprecated NOTE Color value parameters to functions supporting CMYK are interpreted as CMYK colors if the raster to which they are applied is CMYK Syntax importChannel Channel lt channel name gt Source lt user defined Media object name gt layers lt layer list gt PSD files only RType lt bit dep
100. etHeader Returns the value for the given HTTP header name NOTE getHeader is both a request method where the request headers are returned and a response method where the response headers are returned Syntax req getHeader lt name gt Parameters name specifies the header name Example function main var respText new TextResponse TextResponse TypePlain var headers req getHeaderNames for var i 0 i lt headers length i respText append headers i req getHeader headers i n resp setObject respText RespType Streamed Sample Output accept accept encoding gzip deflate accept language en us connection Keep Alive host localhost GJ oO user agent Mozilla 4 0 compatible MSI 0 Windows NT 5 1 0312461 getFileParamNames Returns an array containing the names of all file parameters File parameters describe files that have been sent to the Media Generator through the NET or Java APIs for processing The names returned by this method may be used in conjunction with getFileParamPath to locate the files reference by the file parameters These names are specified when the file is added as a parameter to a request using the NET of Java APIs Please refer to the Java or NET API documentation for more details Syntax var fileNameList req getFileParamNames Parameters This function takes no parameters get
101. format If data is not specified or null clear any metadata for the specified format Data must be an appropriate XML document for the format specified and should be validated against the relevant schema NOTE For Exif and IPTC formats only elements present in the respective schema will be added to the image on save Any other data present in the document will be ignored Syntax lt object name gt setMetadata lt format gt lt data gt Parameters format the format of the document specified by data Valid values are Exif IPTC and XMP data a string containing an XML document corresponding to format setPixel Sets the color of one pixel to the chosen color value This works in both RGB and CMYK color spaces Syntax lt objectname gt setPixel x lt pixel gt y lt pixel gt transparency 0 255 or true or false color lt color gt layers lt layer list gt PSD files only Parameters x and y required parameters that specify the coordinates of the target pixel The top left corner of an image is represented by the coordinates 0 0 transparency this optional parameter sets the alpha channel of the pixel to that value Valid values are 0 255 If this parameter is not specified the alpha channel if any of the original image remains unchanged color this optional parameter specifies the color that will replace the designated pixel The d
102. function has no parameters Example if image getResHorizontal 72 Dees getResVertical Returns the vertical resolution in DPI Syntax lt object name gt getResVertical Parameters This function has no parameters Example if image getResVertical 72 ETT getSamplesPerPixel Returns the number of samples per pixel Syntax lt object name gt getSamplesPerPixel Parameters This function has no parameters Example if image getSamplesPerPixel 3 ETE getWidth Returns the horizontal size in pixels Syntax lt object name gt getWidth Parameters This function has no parameters Example if image getWidth 480 EE getXmlinfo Returns an xml document contain the installed file formats This document looks like following lt fileformats gt lt fileformat gt lt name gt format name lt name gt lt version gt format version lt version gt lt extensions gt comma separated list of extensions lt extensions gt n lt modes gt read write lt modes gt lt fileformat gt lt fileformats gt Syntax xmlString media getXmlinfo Parameters This function has no parameters glow Produces a glow or halo around the image It is similar to the dropShadow method and is based on the alpha channel of the image Its effects are best seen when compositing the results onto another image NOTE Occasional unexpected results can often be corrected with the
103. g from zero as an argument Syntax lt object name gt getLayerName lt layer or layername gt e Parameters layer index specifies the desired layer index starting from 0 MediaScript Objects and Methods 87 Example var image new Media image load name peppers psd if image getLayerName 2 GreenPepper dt aves getLayerOpacity Returns the opacity of the media layer with the specified index if available For more information about opacity settings see composite on page 63 Syntax lt object name gt getLayerOpacity lt layer index gt i Parameters layer index specifies the desired layer index starting from 0 Example var image new Media image load name peppers psd if image getLayerOpacity 2 50 aa getLayerX Returns the X offset of the media layer with the specified index if available NOTE X and Y layer offsets determine relative positions of layers to each and are used by the collapse function Syntax lt object name gt getLayerx lt layer index gt Parameters layer index specifies the desired layer index starting from 0 Example var image new Media image load name peppers psd if image getLayerX 2 25 ees getLayerY Returns the Y offset of the media layer with the specified index if available NOTE X and Y layer offsets determine relative positions of layers to each and are used by the collaps
104. ge Appendix A tVersion tVersion string tFlashPixVersion tFlashPixVersion string tUserComment tUserComment string tColorspace Description Sets the DateTime field from a MediaScript Date object Returns the photographer copyright Sets the photographer copyright Returns the editor copyright Sets the editor copyright Returns the camera make Returns the camera model Returns the image width Returns the image height Returns the number of bits per sample Returns the compression type Returns the photometric interpretation Returns the planar configuration Returns the YCbCr sub sampling Returns the YCbCr positioning Returns the horizontal resolution Returns the vertical resolution Returns the resolution unit Returns the white point Returns the primary chromaticities Returns the YCbCr coefficients Returns the ReferenceBlackWhite value Description Returns the Exif version Sets the Exif version default 2 1 Returns the flashpix version Sets the flashpix version Returns the user comment Sets the user comment Returns the colorspace Method ge ge ge tPixelXDimension tPixelYDimension tComponentsConfiguration g ge ge ge tCompressedBitsPerPixel tRelatedSoundFile tDateTimeOriginal tDateTimeDigitized tSubSecTime tSubSecTimeOriginal tSubSecTimeDigitized tExposureTime tShutterSpeedV
105. ge save type jpeg digimarcDetect Returns true if the object includes embedded Digimarc information Otherwise returns false Syntax digimarcDetect Parameters There are no parameters for this function Example var Image new Media Image load name peppers jpg if Image digimarcDetect true Do something if a watermark is dected Image drawText font Arial style Bold DigiMarc watermark has been detected size 20 Image save type jpeg digimarcEmbed Embeds Digimarc information in the specified image Syntax digimarcEmbed Type lt type gt CreatorID lt id number gt CreatorPin lt pin number gt DistributorID lt id number DistributorPin lt pin number gt ImageID lt id number gt TransactionID lt id number gt Yearl lt yyyy gt Year2 lt yyyy gt Adult lt true false Restricted lt true false gt CopyProtected lt true false gt Durability lt value 1 16 gt text A MediaScript Objects and Methods 69 70 Chapter 3 Parameters The following table describes the parameters taken by this method Parameter Type CreatorID CreatorPin DistributerID DistributorPin ImageID TransactionID Yearl Year 2 Adult Restricted CopyProtected Durability Description This indicates the type of digimarc you wish to embed The default is basic O
106. ginals Media Palettes You can store additional palette files in this directory and use the Name parameter to specify the palette to be applied to the image NOTE You can modify the MediaRich server s local properties file to change the default Media Palettes directory See the MediaRich Administrator s Guide for more information MediaRich also allows you to set up virtual file systems and then use the Name parameter to load palettes from a virtual file system Virtual file systems are defined in the MediaRich server s local properties file For example if you define MyPalettes to represent the path C PALS MyPalettes in the local properties file you can use files from the MyPalettes directory with the reduce function image reduce name MyPalettes custom pal NOTE You may need to experiment with dithering and dithertop levels to achieve the results you want in the palette you use For example palettes with a bit depth between 128 and 256 seem to appear best with a Dither value of 8 and a Dithertop value of 6 image reduce Name Palettes Windows 256 pal Colors specifies the number of palette colors to be generated and applied In the case of a media with multiple frames all the frames are reduced to one palette based on the contents of all the frames NOTE The Notbackcolor parameter has been deprecated Dither determines the level of dithering to use for remapping image pixels to the palett
107. gramVersion field Sets the ProgramVersion field Gets the ObjectCycle field Sets the ObjectCycle field MediaRich Metadata Support 175 176 Appendix A Method getByLine getByLineWriter which getByLineTitle which setByLin writer title addByLin ge se ge se ge se ge se ge se ge se s ge se ge se ge se ge se ge se write title tCity tCity string tSublocation tSublocation string tState tState string tCountryCode tCountryCode string tCountryName tCountryName string tOriginalTransmissionReference tOriginalTransmissionReference tring tHeadline tHeadline string tCredit tCredit string tSource tSource string tCopyrightNotice tCopyrightNotice string tContact tContact string addContact string setContactArray array Description Returns an array of ByLine objects each of which contains a ByLineWriter and a ByLineTitle property Returns the ByLineWriter property of the ByLine element specified by which Returns the ByLineTitle property of the ByLine element specified by which Sets the ByLine element to the specified writer and title Adds an element to ByLine for the given writer and title Returns the City element Sets the City element Returns the Sublocation Sets the Sublocation Returns the State Province Sets the State Province Re
108. haracters By default this is set to true If you do not want to use kerning this must be specified as false NOTE PostScript fonts store the Kerning information in a separate file with a afm extension This file must be present in order for kerning to be applied to the text DPI allows you to specify the image resolution in dots per inch DPI NOTE The DPI parameter is not available if MediaRich is running on Mac Linux or Solaris Fillcolor specifies the color to be used for the background The default value is black ClearType if specified as true the Windows ClearType text renderer will be used if available FitText if specified as true any empty space surrounding the generated text is removed Example var image new Media image makeText text Your message goes here Font Arial Style Bold color Oxffff00 smooth true image save type jpeg measureText Returns an array of offsets where each character would be drawn for a single line of text If more that one line of text is specified by including n then only the first line of text is measured This method is available for Windows only Syntax measureText text lt string gt font lt font family gt size lt value 1 4095 gt style lt modifier gt spacing lt spacing gt smooth lt true false gt ClearType lt cleartype gt Windows only kern lt true
109. he string does not specify a file system the defaultis the write file system See File Systems on page 14 for more information MediaScript Objects and Methods 29 rmdir Removes the specified directory and returns true if the directory could be removed and false if it could not Syntax var success lt object name gt rmdir lt recurse gt Parameters recurse controls whether the contents of the specified directory are deleted If this is set to true the directory and all of its content is removed If set to false the directory is only deleted if it is empty write Writes a string to the end of the file Syntax lt object name gt write lt String gt Parameters string specifies the string to write The string must be in quotes Global Request and Response Objects 30 Chapter 3 For every request MediaScript creates a global HTTPRequest object named req and a global HTTPResponse object named resp You can use the request object to get request parameters HTTP headers and information about the MRL The request object interface is described in detail in the HTTPRequest reference section You can use the response object to set the response contents HTTP response headers and status code See HTTP Response Methods on page 36 for more details Setting the Response Contents There are several ways to set the response contents The simplest is to use the Media object s sa
110. he Media object as a BMP EPS GIF JPEG PCX PDF PICT PNG PPM PSD SWF TIFF TGA or WBMP Syntax save name ftp username password ftp server name filename virtualfilesystem filename type lt typename gt embedICCProfile lt true false gt interlaced lt true false gt GIF and PNG files only loopcount lt value gt GIF files only removeduplicates lt true false gt GIF files only delay lt value gt GIF files only disposalmethod lt mode gt GIF files only quality lt value 1 100 gt JPEG files only progressive lt true false gt JPEG files only baseline lt true false gt JPEG files only colorspace lt type gt JPEG files only highdetail lt true false gt JPEG files only dontoptimize lt true false gt JPEG files only compressionlevel lt value 0 9 gt PNG files only endian lt byte order gt TIFF files only compression lt mode gt TIFF files only SaveMetadata lt true false gt 124 Chapter 3 Parameters name specifies the name used to save a file to an FTP URL image save name ftp jdoe ax24z87 ftp equilibrium com test gif NOTE FTP support is disabled by default for security reasons Contact your MediaRich Administrator to enable this functionality image save name ftp jdoe ax24z87 ftp equilibrium com test gif
111. he copy can be modified independently with changes to one object not affecting the other Syntax lt object name gt clone Parameters This function has no parameters Example var original new Media original load name weasel tga original scale xs 250 constrain true var copy original clone collapse Collapses a multi layer Photoshop file into a single layer This function always results in a 32 bit image NOTE This function supports the CMYK color space if all layers in the image are CMYK Syntax collapse layers lt layer list gt PreserveAlpha lt true false gt IgnoreAlpha lt true false gt VisibleOnly lt true false gt likePS lt true false gt J3 MediaScript Objects and Methods 57 58 Chapter 3 Parameters layers specifies the layers to collapse and the order in which to collapse them The layer numbers begin at 0 background and go up The default collapses all layers from bottom to top The layer list must be contained in quotes and consists of comma separated entries You can specify ranges 0 2 or individual layers 0 2 If you specify the layers out of order and they are composited accordingly NOTE When you specify a comma separated list of layers do not leave any spaces after the commas If the Photoshop file has named layers you can use the layer names up to 31 characters in place of layer numbers You can a
112. he gradient This value can range from 10 to 150 reverse when specified reverses the direction of the applied gradient colori and color2 used as an alternative to specifying a common gradient these parameters specify a custom gradient created by blending the two specified RGB colors If only one of these parameters is specified a gradient is created that blends between the specified color and transparent gradient specifies a common color gradient that blend two or three standard colors The available gradients are RedGreen VioletOrange BlueRed Yellow BlueYellowBlue OrangeYellowOrange VioletGreenOrange YellowVioletOrangeBlue Copper Chrome Spectrum NOTE If color1 and or color2 are specified together with gradient a parameter clash error occurs opacity specifies opacity of the source image The default value is 255 completely solid NOTE If the source image already has an alpha channel that renders it less than solid specifying opacity can only make it less opaque it cannot override the alpha channel to make it more opaque blend specifies the type of blending used to combine the drawn object with the images Blend modes are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize caus
113. he kerning information in a separate file with a afm extension This file must be present in order for kerning to be applied to the text Blend specifies the type of blending used to combine the drawn object with the images Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize causes only the hue component of the source to be stamped down on the image and Prenormal Tile if set to true the text wraps continuously along both the x and y axis so that it spans the entire target image The tiling starts in the location specified by the X and Y and HandleX and Handley parameters If not specified tiling starts from the target image s center NOTE If the source image is larger than the target image setting the Tile parameter to true has no effect unless the source image is sufficiently offset from the center to allow this effect to display Append if set to true drawText appends the text of the previous call to the specified text string NOTE Append works best when drawing a single line of left justified text as subsequent calls to drawText will not maintain the wrap or justification information ClearType if specified as true the Windows ClearType tex
114. hen specified brightness adjustments will avoid maxing out either high or low the image by reducing the contrast accordingly A contrast offset can be used to override this process Invert inverts the values of the three color channels When mixed with any other settings in this command all other calculations are performed first then the inversion is applied as a last step Example var image new Media image load name car tga image adjustRgb red 120 blue 50 green 20 invert true image save type jpeg arc Draws and positions an arc on the image based on the specified parameters This method accepts all composite parameters except HandleX and Handley The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution MediaRich uses white NOTE Using arc to mask frames within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the masking arc outside the loop Syntax arc X lt pixel gt Y lt pixel gt Rx lt value gt Ry lt value gt Startangle lt value 360 360 gt Endangle
115. hods The image conversion methods are all member functions of the Media object e The colorCorrect method is the primary method used for converting between a source device represented by the source profile and a destination device represented by the destination profile e The colorToImage method provides a mechanism for converting a single color from a specified source to the image colorspace e The colorFromImage method converts a single color from the image colorspace to a specified destination e The embeddedProfile method tests an image to see if it has an embedded profile e The getEmbeddedProfileName method returns the name of the embedded profile e The saveEmbeddedProfile method will save the embedded profile to a file e The setSourceProfile method sets the embedded profile for an image to the specified profile For specific details of these functions see Media Object on page 43 Appendix B Profile Management methods With the exception of the load and save methods of the Media object the profile management methods are contained in the IccProfile link object Media Object The load method of the Media object automatically loads any embedded source profiles for supported file formats The save method can optionally embed the color profile associated with an image along with the image data for supported file formats By default embedded profiles are always saved for CMYK images but not for RGB images
116. ide refer to the ECMAScript specification at http www ecma ch ecmal STAND ECMA 262 htm or to a JavaScript reference guide MediaRich also allows users to perform data queries and interact with ODBC compliant databases through the Database Cursor and Stproc objects For information on how to use these objects go to ftp ftp nombas com pub isdkeval se430 manual c html TH 15927 htm Working with Media Processing Functions MediaScript is able to execute a number of media processing functions or transforms that you can use to generate almost any type of graphic Each function has a specific syntax and most include specific parameters that you can use to provide the information needed to execute the transform as desired There are also generic parameters non executing parameters and multi frame parameters that apply to all transform commands Non Executing Parameters All transform commands can use two informational parameters ParamInfo if specified all the other parameters of the command are ignored Instead a list of the legal parameters for that command are printed to the logfile or screen ParamCheck if specified the specified function parameters are parsed and checked for legality and any resulting errors are returned but the command does not execute MediaScript Objects and Methods 163 164 Chapter 3 Multi Frame Parameters Multi frame files such as GIF and TIFF are a special case because the files co
117. ighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under and Colorize NOTE Burn has been deprecated ColorBurn results in the same blend Example var image new Media image load name peppers psd if image getLayerBlend 0 Saturation eaters getLayerCount Returns the total number of layers for the media Syntax lt object name gt getLayerCount Parameters This function has no parameters Example for x 0 x lt image getLayerCount x ass Layer image getLayer x seh MediaScript Objects and Methods 85 86 Chapter 3 getLayerEnabled Returns true if the named layer is enabled visible false if not If you use the collapse function without naming specific layers MediaRich collapses all enabled layers and ignores disabled layers Use the getLayerEnabled function to determine if a layer is enabled or not Use the setLayerEnabled function or the eye icon in Photoshop to enable disable a layer Syntax lt object name gt getLayerEnabled lt layer index gt Parameters layer index specifies the desired layer index starting from 0 Example if image getLayerEnabled 2 false image setLayerEnabled 2 true wa getLayerHandleX Re
118. ile e Layers the number of layers in the file Syntax var fileInfo Media getFileInfo name tif 32bit tif Parameters The only parameter is the specified file name MediaScript Objects and Methods 43 44 Chapter 3 Example var fileInfo Media getFileInfo name tif 32bit tif for key in filelInfo print key fileInfo key n Individual properties can be accessed like this var fileInfo Media getFileInfo name tif 32bit tif var width filelInfol Width getFileFormats Use this method to get a description of the available file formats It returns an array of objects describing the available file formats Each element of the array contains the following fields e type The file format type e extensions A comma delimited list of file extensions for the format e flags A bitwise OR of one or more of the following flags Media FormatLoad Media FormatSave Media FormatCmykSave FormatExifLoad FormatExifSave FormatIPTCLoad FormatIPTCSave Format XMPLoad FormatXMPSave Syntax gt Indicates that the format is loadable gt Indicates that the format is saveable gt Indicates that the format can save CMYK files gt Use if the format supports loading Exif metadata gt Use if the format supports saving Exif metadata gt Use if the format supports loading IPTC metadata gt Use if the format supports saving IPTC me
119. ilename http server name filename ftp username password ftp server name filename ftp ftp server name filename virtualfilesystem filename gt type lt typename gt detect lt true false gt transform lt true false gt FPX files only layers lt layer list gt PSD files only temporaryFileName lt filename gt collapsed lt true false gt PSD files only VisibleOnly lt true false gt PSD files only PreviewAlpha lt true false gt PSD files only transform lt true false gt FPX files only fillalpha lt true false gt PNG files only screengamma lt value 0 10 gt PNG files only waplook lt true false gt WBMP files only dpi lt value 1 32767 gt EPS PDF and PS files only LoadMetadata lt true false gt Parameters name specifies the filename and path full or relative of the file to be loaded By default MediaRich looks for media in the read file system which points to the following directory MediaRich Shared Originals Media You can modify the MediaRich server s local properties file to change the default Media directory See the MediaRich Administrator s Guide for more information You can also load a file from an HTTP or FTP URL using the name parameter NOTE The functionality of loading files from HTTP or FTP sources is disabled by default for security reasons Contact
120. iles Saving a file to the MediaRich cache results All other read operations read All other write operations write For example the following MediaScript img load name bike tif is equivalent to img load name read bike tif Some MediaScript file systems are not based on the standard disk file system The mem specifier uses an abstract file system that is contained entirely in memory and is never written to disk which is useful for fast access to temporary file data The FSNet plug in implements the ftp and http specifiers which allow files to be accessed using FTP and HTTP URLs respectively Creating Custom File System Aliases To define your own file system alias all you need to do is create an entry in the local properties file Virtual file systems paths must start with an alphabetic character but can then contain any alpha numeric characters For example if you want MediaRich to read source media from a storage server with a UNC path of Using MediaScript 15 16 Chapter 2 STOR1 source and write the output to a web server with a UNC path of WEB1 retaill images append the entries to your local properties file asin the following example virtualfilesystem retailIN STOR1 source virtualfilesystem retailOUT WEB1 retaill images NOTE The backslash character is the escape character for MediaRich properties files All backslashes in the path must be escape
121. image2 image composite color 0x009900 image save type jpeg Onto when specified the system composites the source onto the loaded image This way the current media acts like the source and the loaded one acts like the background The user can construct a source image and then composite it onto another image without having to cache the source NOTE Trying to composite an RGB image onto a CMYK image or vice versa results in the process stopping at the composite line with an error Opacity specifies opacity of the source image The default value is 255 completely solid NOTE If the source image already has an alpha channel that renders it less than solid specifying opacity can only make it less opaque it cannot override the alpha channel to make it more opaque Specifying a color value for Unlock causes the selected foreground source image to display only where the specified color value appears in the current background image Color colorizes the source image Any transparency or masking still behaves normally This allows a source image to be used as a pattern that can be composited in any color without having to create a new image first For more information about colorizing an image see colorize If a color palette exists for the source image you can use the Index parameter to colorize the image as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index
122. includes the following object methods e new Media constructor e addArgument e adjustHsb e adjustRgb rc lur urBlur lurGaussianBlur lurMoreBlur e FoF FF fF lurMotionBlur e clone collapse colorCorrect e colorize colorFromImage colorToImage composite convert crop e discard e drawText e dropShadow e ellipse embeddedProfile equalize exportChanneli e fixAlpha Elipi e frameAdd getBitsPerSample getBytesPerPixel getFrame getFrameCount getHeight 46 Chapter 3 getImageFormat getiInfo getLayer getLayerBlend getLayerCount getLayerEnabled getLayerHandlex getLayerHandleyY getLayerIndex getLayerName getLayerOpacity getLayerxX getLayerY getMetaData getPalette getPaletteSize getPixel getPixelFormat getPixelTransparency getPopularColor getResVertical getResHorizontal getSamplesPerPixel getWidth getXmlinfo glow importChannel infoText line load loadAsRgb makeCanvas makeText measureText noiseAddNoise otherHighPass otherMaximum otherMinimum pixellateFragment pixellateMosaic MediaScript Objects and Methods 47 e polygon
123. ion Typically converting from one monitor s colorspace to another monitor s colorspace results in no noticeable loss of color quality However converting from an RGB colorspace to a CMYK colorspace will typically result in changes in the color from the original This loss is caused by the fact that monitors typically have larger gamuts than printers For photographic images this loss is typically small since most naturally occurring colors can be produced equally well on monitors and printers For computer generated images the loss is typically larger since there are many colors representable on a monitor that cannot be achieved with ink on paper Printer profiles are usually constructed with a large number of sample points for converting colors to the printers colorspace However to make the profiles reasonably small far fewer sample points are usually provided for converting from the printers colorspace Therefore color conversions using printer profiles as the source colorspace should be avoided whenever possible Appendix B Because of the inherent inaccuracy in the color conversion process converting from one colorspace to another and back should also be avoided where possible Images for processing should be converted to a common colorspace processed and converted to the destination Choice of the common colorspace depends on the colorspace of the images involved the type of images involved the quality of the color profiles
124. ipt Objects and Methods 165 166 Chapter 3 Examples The following script uses the MediaGenClient COM object to call another MediaScript function main var mgen COMCreateObject MediaGenClient MGClient mgen ScriptName testtext ms mgen SetParameter args 20 mgen ExecuteScript mgen SaveBuffer System getNativePath write comsave jpg resp setPath write comsave jpg NOTE This example is not generally recommended as it can cause deadlocks It is provided for instructional purposes only error This function has been deprecated Use the standard JavaScript try catch finally and throw syntax instead getPropertyValue Returns a string with the value of the named property If the named property does not exist returns undefined MediaRich includes two properties files that specify various system settings The files are local properties and global properties Using the getPropertyValue function you can access these files from within a MediaScript NOTE Properties are controlled by the MediaRich system administrator using the Admin Center See MediaRich Administrator s Guide for more information Syntax getPropertyValue lt property name gt Parameters Enter the property name in quotes Property names consist of the filename in which the u n property exists excluding the extension a and then the actual property name NOTE Property name inform
125. is always 0 Syntax var batchId req getBatchId MediaScript Objects and Methods 35 36 Chapter 3 Parameters This function has no parameters getJobTempDir Returns the path to a local temporary directory for use by the current job This directory is created at the start of each request and deleted when the request completes Syntax var tmpDir req getJobTempDir Parameters This function has no parameters getBatchTempDir Returns the path to a local temporary directory that is shared by all jobs within a given batch This directory may be used to share state between different jobs in a given batch For a description of the MediaRich batch interface see the NET or Java API online documentation available in the SDK folder Syntax var tmpDir req getBatchTempDir Parameters This function takes no parameters getPath Returns the path previously set using setPath Syntax resp getPath Parameters This function takes no parameters HTTP Response Methods The resp object includes the following methods setObject getObject e setPath getPath e setMedia e getMedia e setRespons A lype lype setSaveParameters m e getRespons getSaveParameters setMimeType getMimeType setHeader getHeader setStatusCode getStatusCode e write writeLine setObject
126. iving superior results but is slower than both the fast and smooth algorithms ang lex specifies the number of degrees the image will be rotated around the x axis A positive angle rotates away from the viewer about the top or left edge A negative angle rotates away from the viewer about the bottom or right edge ang ley specifies the number of degrees the image will be rotated around the y axis A positive angle rotates away from the viewer about the top or left edge A negative angle rotates away from the viewer about the bottom or right edge NOTE You can specify a value for only one of the Anglex or Angley parameters and only values between 89 and 89 are permitted distance gives the distance in pixels the viewer is away from the image The default value is twice the longest dimension of the image which gives a nice look If a more extreme perspective is required use a smaller value for distance If a less extreme perspective is required use a larger value NOTE The value of distance must be greater than zero layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 MediaScript Objects and Methods 123 Example var image new Media image load name pasta tga image rotate3d angley 30 distance 28 image save type jpeg save Saves a Media object to the specified file You can save t
127. ixAlpha command See fixAlpha for more details The foreground and background colors may vary with this function depending on the original Media object If the object has foreground and background colors or such colors are set with the setColor function MediaRich uses the set colors including the CMYK color space MediaScript Objects and Methods 93 94 Chapter 3 However if the object has no set background color MediaRich does the following e For objects with 256 colors or less MediaRich uses the first color index e For objects with 15 bit or greater resolution including the CMYK color space MediaRich uses black If the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution including the CMYK color space MediaRich uses white Syntax glow Blur lt value 0 30 gt Size lt value 1 30 gt Halo lt value 0 30 gt Opacity lt value 0 255 gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt ResizeCanvas lt true false gt layers lt layer list gt PSD files only e Parameters Blur adds a specified blur to the shadow that gives it a more diffused look Note however that the larger the blur value the more processing is required Size specifies how large in pixels the glow surrounding the image shou
128. ize Returns the number of colors in the palette or 0 if the image does not have a palette Syntax var nColors lt object name gt getPaletteSize Parameters This function has no parameters getPixel Returns the color value omitting any alpha channel For RGB images this will be a 24 bit color value For CMYK a 32 bit color value Syntax lt object name gt getPixeli X lt pixel gt Y lt pixel gt layers lt layer list gt PSD files only Parameters X and Y specify the coordinates of the target pixel The top left corner of an image is represented by the coordinates 0 0 layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name peppers psd if image getPixel X 25 Y 100 rgb 255 0 0 Casi 90 Chapter 3 getPixelFormat Returns a string representing the image type Gray 8 RGB 15 RGB 16 RGBA 16 RGB 18 RGB 24 RGBA 32 HSV 24 HLS 24 CMYK 32 CMYKA 40 Syntax lt object name gt getPixelFormat Parameters This function has no parameters Example var image new Media image load name peppers psd if image getPixelFormat RGB 24 fda getPixelTransparency Returns the value for the alpha channel or 255 if there is no alpha cha
129. jpeg ellipse Draws and positions an ellipse on the image based on the specified parameters This method accepts all composite parameters except HandleX and Handley The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or less MediaRich uses the last color index e For objects with 15 bit or greater resolution MediaRich uses white NOTE Using ellipse to mask frames within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the masking ellipse outside the loop Syntax ellipse X lt pixel gt Y lt pixel gt Rx lt value gt Ry lt value gt Opacity lt value 0 255 gt Unlock lt color in hexadecimal or rgb gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Saturation lt value 0 255 gt PreserveAlpha lt true false gt Blend lt blend type gt Width lt value gt Smooth lt true false gt Fill lt true false gt Parameters X specifies in pixels the x axis coordinate for the center point of the ellipse This parameter is required and has no default value Y specifies in pixels the y axis coordinate for the c
130. k directive is a preprocessing flag that is evaluated before the script is parsed or executed It allows DLLs to be included as if they were part of the original script and takes a string representing the relative path of the filename to include Syntax link lt relative path to the included file gt Example link lt process library dll gt If your MediaScript uses the Database Cursor or Stproc object it must include the following line at the beginning of the script link lt Database dll gt Named Arguments When reading the object reference section of this chapter you will see that many of the Media object s methods use an argument notation of the form argName argValue The reason for this notation is that these methods often have a long list of optional and sometimes mutually exclusive arguments The save method for example has sixteen arguments many of which only apply to certain file formats Moreover adding a new file format plug in to the system can add even more arguments Because of this certain methods take a set of name value pairs rather than the standard positional argument list MediaScript introduces the at operator to simplify named arguments as in the following argNamel argValuel argName2 argValue2 For example if you have a Media object named img and you want to save the contents to a JPEG file named out jpg at 90 quality the MediaScript looks like the foll
131. kwise by the specified angle in degrees Line specifies line spacing The default spacing between lines of text is 1 5 Smooth specifies that the text is drawn with five level anti aliasing MediaScript Objects and Methods 73 74 Chapter 3 SmoothFactor specifies the power of two for image scale based smoothing If 1 is specified the text will be drawn at twice the specified size and scaled down If 2 is specified the text is drawn at four times the size This scaling produces smoother text for renderers with poor anti aliasing at smaller text sizes The Smooth parameter must be set to true for this parameter to have any effect Baseline if specified the text is treated as though it is always the height of the largest character This allows text to be aligned between different calls to the function The distance in pixels between the baselines of two lines of text is 1 5 times the point size of the text Thus for 30 point text the line spacing is 45 pixels If this parameter is not specified this function measures the actual height of the text and centers it accordingly Spacing adjusts the spacing between the text characters The default is 0 A negative value draws the text characters closer together Kern if set to true which is the default it optimizes the spacing between text characters If you do not want to use kerning specify this parameter as false NOTE PostScript fonts store t
132. ld be Halo specifies the gap between the image and the start of the glow The value for halo must always be smaller than the size of the glow The default value is zero Opacity defines the level of transparency for the shadow The default opacity is 255 which is completely solid NOTE The shadow affects the alpha channel of the image as well as the visible channels Color defines the color of the glow and the default is the foreground color Index colorizes the glow using an index value from the available color palette for the source image as an alternative to the Color parameter NOTE You cannot specify values for both the Color and Index parameters ResizeCanvas automatically resizes the canvas of the image to encompass the shadow produced The image s background color will be used for the additional area For more information about setting an image s background color see setColor on page 131 layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media var image2 new Media image load name peppers tga image2 drawText font Arial style Bold text Fresh Peppers angle 0 color Ox00ccff size 36 smooth true baseline false kern true image2 glow Blur 4 Size 8 Halo 0 Opacity 220 Color OxFFFFO0 ResizeCanvas false
133. le on Windows only This parameter only affects text with multiple lines MediaScript Objects and Methods 107 108 Chapter 3 Wrap if specified its value forces a new line whenever the text gets longer than the specified number of pixels in this case correct word breaking is used Angle allows the text to be rotated clockwise by the specified angle in degrees Line specifies the line spacing The default spacing between lines of text is 1 5 Smooth specifies that the text is drawn with five level anti aliasing SmoothFactor specifies the power of two for image scale based smoothing If 1 is specified the text will be drawn at twice the specified size and scaled down If 2 is specified the text is drawn at four times the size This scaling produces smoother text for renderers with poor anti aliasing at smaller text sizes The Smooth parameter must be set to true for this parameter to have any effect Baseline if specified the text is treated as though it is always the height of the largest character This allows text to be aligned between different calls to the function The distance in pixels between the baselines of two lines of text is 1 5 times the point size of the text Thus for 30 point text the line spacing is 45 pixels If this parameter is not specified makeText measures the actual height of the text and centers it accordingly Kern if set to true optimizes the spacing between text c
134. les Compressionlevel sets compression level The default is 6 A Compressionlevel value of 9 can be very slow in processing Additional Parameters for EPS Files binary ifset to false writes an ASCII EPS file If not specified it defaults to true and writes a binary EPS file preview if set to false writes an EPS file without a TIFF preview If not specified it defaults to true and writes a preview TIFF to the file debabCompat if set to false writes a smaller file that is not compatible with DeBabelizer If not specified it defaults to true and writes larger but DeBabelizer compatible file 126 Chapter 3 previewAtEnd if set to true writes the TIFF preview at the end of the file If not specified it defaults to false and writes the TIFF preview at the beginning of the file Additional Parameter for TIFF Files Wd Yh endian indicates the byte order Values of big mac motorola and sparc save the data in big endian byte order little pc intel and x86 save the data in little endian byte order Compression indicates the compression scheme to use Valid values are none e rle compresses runs of identical byte sequence values into code only a few bytes in length e faxg3 outputs TIFF files that conform to the Group 3 FAX format e faxg4 outputs TIFF files that conform to the Group 4 FAX format
135. lidate the document These operations are summarized in the following table Method Description IPTCMetadata validate Constructs a blank IPTC metadata document If validate is true the document is automatically validated in set lt tag gt methods ExifMetadata validate Constructs a blank Exif metadata document loadFromFile filename Load metadata object with data from the specified file loadFromMedia media Load metadata object with data from the specified media loadFromXML xmlString Load metadata object with data from the specified XML string blankDocument Load metadata object with a valid blank document validate Validates the document to the appropriate schema isEmpty Returns true if the document is empty NOTE Each metadata constructor constructs a blank metadata document of the appropriate type This document is not empty It is a valid XML document for the appropriate metadata schema However loadFromFile and loadFromMedia will leave the document in an empty state if the file contains no metadata of the appropriate type var metadata new IPTCMetadata var empty metadata isEmpty returns false metadata loadFromFile img jpg if metadata isEmpty do something with metadata else Appendix A file did not contain metadata Alternatively you can simply use the get lt Tag gt methods which will return null if the document is empty IPTCMetadataObject
136. lizeTraceContour Creates a contour line effect by locating the transitions of the more significant bright areas and outlining them for each color channel NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax stylizeTraceContour Level lt value 0 255 gt Upper lt true false gt Invert lt true false gt MediaScript Objects and Methods 147 148 Chapter 3 Parameters Level indicates the level of each color gun The default is 128 Upper if set to true causes the upper edge to be delineated The default is false the lower edge is delineated Invert if set to true reverses the default foreground and background colors The default is false Example var image new Media image load name peppers tga image stylizeTraceContour Level 96 Upper true Invert true image save type jpeg zoom Zooms in ona specified portion of the media and fits it to the specified size This constitutes a crop followed by a scale This function fully supports the CMYK color space Syntax zoom Alg lt Fast Smooth Outline Best gt Xs lt pixels gt Ys lt pixels gt X lt left pixel Y lt top pixel gt Scale lt value gt PreserveBackground lt true false gt Preserve
137. low and Collaboration Users can ensure that the most current approved image is used by taking advantage of SharePoint s routing and approval process version control and check in check out system Search and Browse Users can search directly from a Microsoft Office application or within SharePoint Portal Server and Windows SharePoint Services sites This includes viewing a thumbnail preview or zooming in for detailed inspection regardless of the original file format Users can also browse a hierarchical view of all the available document and picture libraries from a single Web Part Metadata Support MediaRich for SharePoint ingests metadata automatically when images are uploaded into the system Users can view image properties as well as IPTC and EXIF industry standard information and they can easily update these fields store the information in SharePoint and write it back to the original files for future use Image Transformations MediaRich for SharePoint provides comprehensive image editing for image creation modification and delivery It can automatically transform images using corporate guidelines as well as provide the flexibility to select the file format size and resolution before downloading Batch Processing Any modification that needs to be made to a single image can be applied to an unlimited number of images Administration controls allow users to view current job items their status and cancellation In addition the resu
138. lso use the as a wildcard when specifying layers For example image collapse layers B This line of script collapses all layers whose names begin with B such as Boy Baseball Ballcap and so on The layers command is case sensitive so the example line of script will not flip layers that begin with a lowercase b PreserveAlpha when set to true preserves the alpha channel of the target image layers as the alpha channel of the resulting collapsed image The default is false IgnoreAlpha when set to true the alpha channel information is ignored when collapsing the image layers The default is false VisibleOnly when set to true only the layers designated as visible are included in the collapsed image The default is false likePS if set to true performs the collapse like Photoshop The default background color is white and the alpha channel is determined by the first layer specified for the collapse The default is false NOTE Because 1ikePS uses a white background color this parameter should be disabled for images that will later be used as a brush Example var image new Media image load name pasta psd image collapse layers 0 2 likePS true image save type jpeg colorCorrect Transforms an image from a source color space to a destination color space MediaRich supports ICC profiles for the following formats EPS JPEG PDF PS PSD and TIFF
139. lt is false Blend specifies the type of blending used to combine the drawn object with the images Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize causes only the hue component of the source to be stamped down on the image and Prenormal NOTE Burn has been deprecated ColorBurn results in the same blend Width specifies the thickness in pixels of the line that describes the ellipse The default is 1 NOTE If the Fill parameter is set to true Width is ignored Smooth if set to true makes the edges of the ellipse smooth preventing a pixellated effect The default is false Fill fills in the ellipse with the color specified by the Color or Index parameter The default is false Example var image new Media image load name logobg tga image ellipse X 272 Y 180 Rx 50 Ry 30 Opacity 128 Color Ox66CCFF Saturation 128 Blend Hue Smooth true Fill false image save type jpeg embeddedProfile Returns true if the media has an embedded ICC profile false if not Syntax lt object name gt embeddedProfile Parameters This function has no parameters Example if image embeddedProfile false imag
140. lts can be returned back to SharePoint sent to a FTP site and sent using email with a link to the originals or as a compressed ZIP file Microsoft Office Support Users can preview individual pages of Word and Excel documents or full PowerPoint presentations so that they find the exact asset that they are looking for This helps to reduce time and bandwidth with unnecessary downloads and enables users to access individual slides to add to a presentation The Application Programming Framework MediaRich image processing is controlled by MediaScript which provides a simple framework that makes writing new scripts easy The framework provides several distinct benefits e Aclear API for interacting with the rest of the system e Ability to develop individual scripts that can be focused on the processing required e The same scripts can be used for both Export and the MediaCart Working with MediaScript MediaScript is an ECMAScript compliant language like JavaScript or JScript Similar to those other implementations of ECMAScript MediaScript makes available additional host objects relevant to the task at hand This document assumes some familiarity with MediaScript For more information about working with MediaScript see Chapter 2 Using MediaScript and Chapter 3 MediaScript Objects and Methods The most important new object in MediaScript is the Media object which implements the many image processing features provided by Me
141. m To set a property that affects all FSNet filesystems specify that property as follows filesystem fsnet lt property name gt To set a property to only affect a single virtual filesystem specify the property as follows filesystem fsnet lt virtual filesystem name gt lt property name gt The following example sets up a proxy host for all FSNet filesystems filesystem fsnet ProxyHost ourproxyhost 3322 The following example sets the user name and password for just FTP access filesystem fsnet ftp UserNameAndPassword joeblow tokyo The specific properties that affect FSNet s operation are described in the following sub sections As you read this information remember that each of these properties can be specified such that they affect either a single virtual filesystem http or ftp or all FSNet filesystems http AND ftp Authentication Authentication is performed by supplying a user name and password to HTTP and FTP requests These values can be supplied in the URL as described in the previous section They can also be set globally so that all HTTP and or FTP requests use the same user name and password This is done using the UserNameAndPassword property The following are two examples one that sets a user name and password for all FSNet filesystems and another that sets them only for FTP access filesystem fsnet UserNameAndPassword joeblow tokyo filesystem fsnet ftp UserNameAndPasswo
142. m 127 otherMinimum 128 pixellateFragment 129 pixellateMosaic 130 quadWarp 132 sharpenSharpen 157 sharpenSharpenMore 158 sharpenUnsharpMask 158 stylizeDiffuse 161 MediaRich Programming Guide stylizeEmboss 162 stylizeFindEdges 162 stylizeTraceContour 163 fixAlpha 96 flip 97 FPX files 119 Fresco 191 FSNet file systems 38 FTP support 117 G getBitsPerSample 98 getBytesPerPixel 98 getFileName 42 getFilePath 42 getFrame 99 getFrameCount 99 getHeight 99 getImageFormat 100 getInfo 100 getLayer 100 getLayerBlend 101 getLayerCount 101 getLayerEnabled 102 getLayerHandlex 102 getLayerHandleY 102 getLayerIndex 103 getLayerName 103 getLayerOpacity 104 getLayerX 104 getLayerY 105 getMetaData 105 getParentPath 43 getPixel 106 getPopularColor 107 getPropertyValue 182 getResHorizontal 108 getResVertical 108 getSamplesPerPixel 108 getScriptFileName 183 getText 170 getTextType 170 getType 170 getWidth 109 GIF files 141 142 Glass 209 Global Functions 180 184 include 30 link 31 error 182 getPropertyValue 182 MediaRich Programming Guide getScriptFileName 183 print 183 rgb 183 version 184 glow 109 Glowing Edges 232 Gradient 111 Grain 236 Graphic Pen 224 H Halftone Pattern 225 HTTP Request Object methods 47 HTTP Request Object properties 47 HTTP support 117 image editing methods composite
143. m fsnet ftp Ftp 1 HTTP and FTP URLs There are a number of MediaScript methods such as the Media object s load and save methods that accept file paths as parameters The paths passed via these parameters will often be paths to files on the local filesystem but can also refer to resources on a network via the HTTP and FTP protocols By enabling standard HTTP and FTP URLs as described in the previous section references to fileson HTTP and FTP servers take the same form as standard URLs used to access those files via a web browser All of the information normally encoded in HTTP and FTP URLs can be passed to MediaRich MediaRich will use the supplied information to connect to the specified network resource Using MediaScript 17 18 Chapter 2 A fully specified HTTP or FTP URL looks like the following http ftp lt username gt lt password gt lt server name gt lt port gt lt path to resource gt The lt username gt lt password gt and lt port gt portions of the URL are optional Here are some examples of well formed URLs http www eq com images eq bw gif http joeblow abcdefg acomputer myimages blah jpg ftp ftpserver 1234 public images camera tif FSNet Properties A number of properties can be set in the local properties file to influence the behavior of HTTP and or FTP requests These properties can be specified such that they affect all FSNet filesystems or so that they affect only a single filesyste
144. mage The default location for destination profiles is MediaRich Shared Originals Profiles NOTE You can modify the MediaRich server s local properties file to change the default Profiles directory See MediaRich Administrator s Guide for more information sourceProfile specifies the profile to be used as the source for the color transformation if the image has no embedded profile or if the overrideEmbedded parameter is set to true Source profiles must also be located in the Profiles directory An ICC profile embedded in an image is used by default as the sourceProfile unless the overrideEmbedded parameter is set to true intent specifies how the transformation from source to destination color space is effected The possible values for intent are e Perceptual the default intent and works best with photographic images e RelativeColorimetric corrects the image using the relative white points of the source and destination ICC profiles MediaScript Objects and Methods 59 60 Chapter 3 e AbsoluteColorimetric corrects the image to the absolute white point specified in the destination ICC profile e Saturation works best for line art and images that have large areas of one solid color NOTE For multi layer images profiles are associated only with the image and not with any of the layers thus using colorCorrect affects all layers For more information please see Appendix B Medi
145. me string getOriginatingProgram setOriginatingProgram string getProgramVersion setProgramVersion string getObjectCycle setObjectCycle string Description Sets the Speciallnstructions field Returns the ActionAdvised field Sets the ActionAdvised field Returns an array of Reference object for the Reference field Each reference object has a ReferenceService ReferenceDate and ReferenceNumber property Returns the ReferenceService property of the Reference element indexed by which Returns the ReferenceDate property of the Reference element indexed by which as a MediaScript Date object Returns the ReferenceNumber property of the Reference element indexed by which Sets the Reference element to the reference specified by service date and number Date must be a MediaScript Date object Adds a Reference element to the list using the specified service date and number Date must be a MediaScript Date object Returns the DateCreated and TimeCreated fields as a MediaScript Date object Sets the DateCreated and TimeCreated fields from a MediaScript Date object Sets the TimeCreated field Returns the DigitalCreationDate and DigitalCreationTime fields as a MediaScript Date object Sets the DigitalCreationDate and DigitalCreationTime fields from a MediaScript Date object Sets the DigitalCreationTime field Gets the OriginatingProgram field Sets the OriginatingProgram field Gets the Pro
146. meters getLastAccessed Returns the last accessed date in seconds since midnight January 1 1970 If the file does not exist or cannot be accessed the function returns 0 Syntax lt object name gt GetLastAccessed Parameters This function takes no parameters getParentPath Returns the parent path for the object Syntax lt object name gt getParentPath If the object s full file path is C Program Files Equilibrium MediaRich Shared Originals Media camera png getParentPath returns C Program Files Equilibrium MediaRich Shared Originals Media Parameters This function takes no parameters getSize Returns the file size in bytes If file does not exist cannot be accessed or is empty the function returns 0 Syntax lt object name gt GetSize Parameters This function takes no parameters MediaScript Objects and Methods 27 28 Chapter 3 isDirectory Returns t rue if the File object points to a directory otherwise returns false Syntax lt object name gt isDirectory Parameters This function takes no parameters isFile Returns t rue if the File object points to a regular file otherwise returns false Syntax lt object name gt isFile Parameters This function takes no parameters length Returns an integer containing the number of text lines in the file Syntax lt object name gt length Parameters This function takes no pa
147. n Makes the edges in the image more pronounced NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax sharpenSharpen Parameters This function has no parameters Example var image new Media image load name peppers tga image sharpenSharpen image save type jpeg MediaScript Objects and Methods 141 142 Chapter 3 sharpenSharpenMore Sharpens the clarity of an image similar to the sharpenSharpen function but to a greater extent NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax sharpenSharpenMore Parameters This function has no parameters Example var image new Media image load name peppers tga image sharpenSharpenMore image save type jpeg sharpenUnsharpMask Enhances the edges and details of an image by exaggerating the differences between the original image and a Gaussian blurred version NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129
148. n The global functions CmykColor RgbColor and LoadAsRGB are defined in Sys color ms CmykColor This object is constructed from a 32 bit value It splits the color into cyan magenta yellow and black components Constructor CmykColor value returns an CmykColor object constructed from value Properties cyan the cyan component read or write Valid values range from 0 to 255 magenta the magenta component read or write Valid values range from 0 to 255 yellow the yellow component read or write Valid values range from 0 to 255 black the black component read or write Valid values range from 0 to 255 Methods valueOf converts the cyan magenta yellow and black components back to a 32 bit value toString returns string representation of 32 bit value Functions CmykColorFromCMYK cyan magenta yellow black constructs CmykColor from the components CmykColorFromPct cyan magenta yellow black constructs CmykColor from component percentages 0 1 Examples include Sys color ms myColor new CmykColor myColor cyan 27 myColor yellow 122 myColor magenta 115 myColor black 55 media new Media media makeCanvas xs 100 ys 100 fillcolor myColor COMCreateObject COM objects can be created using a global function Parameters progid specifies a string containing the friendly progID of the COM object MediaScr
149. nd Y and HandleX and Handley parameters If not specified tiling starts from the target image s center NOTE If the source image is larger than the target image setting the Tile parameter to true has no effect unless the source image is sufficiently offset from the center to allow this effect to display Blend specifies the type of blending used to combine the drawn object with the images Blend modes are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize causes only the hue component of the source to be stamped down on the image and Prenormal This function supports CMYK for the following blend modes Normal Darken Yah Lighten Screen Multiply Dissolve Overlay HardLight SoftLight Difference Exclusion Burn Dodge Under Copy and PreNormal The other modes Hue Saturation Color Luminosity and Colorize are not supported for CMYK You must first convert to RGB using colorCorrect and then perform the composite Additionally composite cannot be performed unless both images are either CMYK or RGB Example var Target new Media var Source new Media Target load name pasta
150. ng the MediaRich for SharePoint Server installation If you are not aware of the details of your installation you should consult your System Administrator Metadata Support MediaRich fully supports loading saving and merging IPTC EXIF and XMP metadata for JPEG TIFF and Photoshop files MediaRich also supports loading XMP metadata from the following file formats Illustrator EPS GIF PDF and PNG This metadata is available to the script as a metadata XML document Detailed schemas are provided for the EXIF and IPTC documents constructed by MediaRich The XMP metadata document conforms to the schema defined by Adobe The MediaRich for SharePoint product currently supports only IPTC and EXIF metadata for JPEG TIFF and Photoshop files For for more information about the Metadata Interface and common methods see Appendix A MediaRich Metadata Support Programming MediaRich for SharePoint 9 10 Chapter 1 Chapter 2 Using MediaScript All MediaRich image templates are written in MediaScript an interpreted scripting language based on the ECMAScript Language Specification 3rd edition which in turn is based on Netscape s JavaScript and Microsoft s JScript By building on top of a widely known scripting language MediaScript can offer all of the flexibility of a full programming language while remaining easy to use MediaScript supports all of ECMAScript s syntax and objects while adding several new objects and language
151. nnel This function fully supports the media object within the CMYK color space Syntax lt object name gt getPixelTransparency X lt pixel gt Y lt pixel gt layers lt layer list gt PSD files only Parameters X and Y specify the coordinates of the target pixel The top left corner of an image is represented by the coordinates 0 0 layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 getPopularColor Returns the 24 bit color value 0 16 777 215 of the color that appears most frequently in the named object for the RGB color space Syntax lt object name gt getPopularColor Precise lt true false layers lt layer list gt PSD files only Parameters Precise if set to false which is the default the color returned will be a close approximation of the actual color that appears most often in the image MediaScript Objects and Methods 91 92 Chapter 3 layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name peppers psd if image getPopularColor rgb 255 0 0 ees getResHorizontal Returns the horizontal resolution in DPI Syntax lt object name gt getResHorizontal Parameters This
152. nt background image Saturation specifies the value used for the weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize Size sets the point size of the font to be used The default size is 12 Justify specifies how the text will be justified The default is center Other options are left right and justified The justified option is available for Windows only This parameter only affects text with multiple lines Wrap specifies a value used to force a new line whenever the text gets longer than the specified number of pixels in this case correct word breaking is used Opacity specifies opacity of the text The default value is 255 completely solid X and Y specify the text s position on the image based on text s anchor point The default value is the center point of the image Handlex and Handley specify the anchor point of the text for example Handlex left center right Handley top middle bottom relative to the placement point of the image as specified by the X and Y parameters described above The default values are center and middle Angle allows the text to be rotated cloc
153. ntacts the HTTP or FTP server to determine whether a newer version of the file exists Ifanewer version does exist MediaRich downloads a new copy of the file to the cache If a newer version does not exist the age of the file in the cache is simply reset to 0 In all cases the cached file is eventually returned to the caller This example disables file caching for FTP accesses filesystem fsnet ftp RefreshInterval 1 And this example refreshes interval for both HTTP and FTP accesses to five minutes filesystem fsnet RefreshInterval 300 Proxy Server Support To route HTTP and FTP file requests through a proxy server use the ProxyHost property A proxy host specification consists of a host name and port number separated by a colon The following is an example that designates that FTP and HTTP requests should be routed to port 1133 of the server named ourproxyserver ourcompany filesystem fsnet ProxyHost ourproxyserver ourcompany 1133 Using MediaScript 19 20 Chapter 2 Defining Additional FSNet Virtual Filesystems Any number of virtual filesystems can be defined in addition to standard http and ftp filesystems The only reason to define additional HTTP or FTP filesystems would be to associate different property settings with the different filesystems For example if you needed to access network files via two different proxy servers you would need two different filesystems as the proxy server c
154. ntain more than one frame MediaScript supports a frames parameter that can be included with all transform commands for processing specific frames within a multi frame file NOTE Multi frame parameters can be used with the save command but not the load command frames specifies a single frame or a complex group of frames using a frame list A frame list must be enclosed in quotes and allows a comma separated list of individual frames or ranges You can also specify a frame skip parameter to apply the relevant command to every nth frame NOTE The first frame in a multi frame file is frame 1 Examples image load name clock gif image flip axis horizontal frames 5 image save name flip5 gif This script flips the 5th frame of the file clock gif image load name clock gif image flip axis horizontal frames 1 5 7 10 image save name multiflip gif This script flips the 1st 5th 7th 8th 9th and 10th frames of the file clock gif image load name clock gif image flip axis horizontal frames 4 10 2 image save name flipskip gif This script flips the 4th 6th 8th and 10th frames for example every 2nd frame of the file clock gif MediaScript Global Functions The MediaScript global functions are e CmykColor e COMCreateObject error e getPropertyValue e getScriptFileName e print e reb e RgbColor Object versio
155. ntax setResolution Dpi lt value 0 00 to 10 000 00 gt XDpi lt value 0 00 to 10 000 00 gt YDpi lt value 0 00 to 10 000 00 gt layers lt layer list gt PSD files only Parameters Dpi sets the resolution of the image in memory The resolution value must be greater than 0 but may be decimal Xdpi and Ydpi set the resolution on their respective axis only NOTE When the Dpi parameter and one or both of the single axis values are given the axis value overrides the DPI value layers for PSD files specifies the layers to be affected The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name peppers tga image setResolution dpi 300 xdpi 200 image save type jpeg setSourceProfile Sets the embedded profile for an image to the specified source profile This profile replaces any existing embedded profile for the image NOTE The colorspace of the specified source profile must match the colorspace of the image Syntax setSourceProfile sourceProfile lt filename icc gt i Parameters SourceProfile specifies the profile to use as the images new embedded profile For more information about specifying profiles see colorCorrect on page 59 For more information about color management please refer to Appendix B MediaRich Color Management sharpenSharpe
156. on and Brightness linear color values that set the base level for the saturation and brightness of the image UseHLS if specified as true causes the adjustment to be performed in the HLS colorspace In this case the Saturation parameter is interpreted as lightness and the Brightness parameter is interpreted as Saturation Example var image new Media image load name car tga image adjustHsb hue 120 saturation 50 brightness 110 image save type jpeg addArgument Adds the specified name value pair to the next Media object method call MediaScript Objects and Methods 49 50 Chapter 3 adjustRgb Alters the contrast brightness and color balance of an image NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection Syntax adjustRgb Contrast lt value 4255 gt Brightness lt value 255 gt Red lt value 255 gt Green lt value 255 gt Blue lt value 255 gt NoClip lt true false gt Invert lt true false gt Parameters The default value for any parameter not specified is zero false Contrast adjusts the overall contrast of the image Brightness adjusts the overall brightness of the image Red Green and Blue adjust the brightness of each of the three color channels individually Noclip w
157. ont specifies the TrueType or PostScript font family name to be used for example Arial MediaRich supports Type 1 pfa and pfb PostScript fonts only NOTE The size of the font in pixels is dependent on the resolution of the resulting image If the resolution of the image is not set zero the function uses a default value of 72 DPI The default location for fonts specified in a MediaScript is the fonts file system Which includes both the MediaRich Shared Originals Fonts folder and the default system fonts folder If a MediaScript specifies an unavailable font MediaRich generates an error NOTE You can modify the MediaRich server s local properties file to change the default fonts directory See the MediaRich Administrator s Guide for more information Style specifies the font style You can use any combination of modifiers Each modifier should be separated by a space character NOTE The Style parameter is not available if MediaRich is running on Mac Linux or Solaris Weight modifiers modify the weight thickness of the font Valid weight values in order of increasing thickness are e thin e extralight or ultralight e light e normal or regular e medium e semibold or demibold semi or demi are also acceptable e bold e extrabold or ultrabold extra or ultra are also acceptable e heavy or black O
158. original filename is unchanged Syntax lt object name gt copy lt source gt Parameters source specifies a string containing the new filename The string must be in quotes If the string does not specify a file system the default is the write file system See File Systems on page 14 for more information exists Returns true if the File object points to an existing file or directory Otherwise it returns false Parameters This function takes no parameters getFileName Returns the filename portion of the object s path Syntax lt object name gt getFileName If the object s full file path is C Program Files Equilibrium MediaRich Shared Originals Media camera png getFileName returns camera png Parameters This function takes no parameters getFilePath Returns the full file path for the object Syntax lt object name gt getFilePath If the object s full file path is C Program Files Equilibrium MediaRich Shared Originals Media camera png getFilePath returns C Program Files Equilibrium MediaRich Shared Originals Media camera png Parameters This function takes no parameters getLastModified Returns the last modified date in seconds since midnight January 1 1970 If the file does not exist or cannot be accessed the function returns 0 Syntax lt object name gt GetLastModified Parameters This function takes no para
159. ormerly named exportGun which has been deprecated MediaScript Objects and Methods 79 80 Chapter 3 Syntax exportChanneli Channel lt channelname gt layers lt layer list gt PSD files only Parameters Valid channel names are e Blue Green Red Alpha e Cyan Magenta Yellow Black CMYK space e Brightness Saturation Hue HSV space e Brightness2 Saturation2 Hue2 HLS space The default value is Blue layers for PSD files specifies the layers to be exported The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name peppers tga image exportChannel channel green image save type jpeg NOTE Comparing the original CMYK image and the newly generated images in Photoshop will show the exact inverse results of what Photoshop displays for the separate channels fixAlpha This function has been removed from MediaScript If it is encountered no operation will be performed Adjusts the RGB components of an image relative to its alpha channel This should be done when an alpha channel has been manually created for an image This command will frequently correct unexpected results in functions that utilize the alpha channel Syntax fixAlpha Example var image new Media image load name
160. oss2 alternate emboss filter e Edges edge filter crop Crops resizes the media to a specified size This function fully supports CMYK The background color may vary with this function depending on the original Media object If the object has a set background color or it is set with the setColor function MediaRich uses the set color However if the object has no set background color MediaRich does the following e For objects with 256 colors or less MediaRich uses the first color index e For objects with 15 bit or greater resolution including the CMYK color space MediaRich uses black MediaScript Objects and Methods 67 68 Chapter 3 Syntax crop Xs lt pixels gt lt percentage gt Ys lt pixels gt lt percentage gt Xo lt left pixel Yo lt top pixel gt layers lt layer list gt PSD files only PadColor lt color in hexadecimal or rgb gt PadIndex lt value 0 16777215 gt Transparency lt value 0 255 gt Alg lt Normal BackColor Color Alpha gt Parameters Xs and Ys specify the size of the resulting image The size can be specified either as an absolute or as a percentage of the original size percentages must be designated by adding the as in the Syntax example Where xs or ys is not specified the original size is used Xo and Yo specify the position of the top left of the marquee to use Where either of these
161. otoshop application Photoshop creates this raster based on the visible layers contained in the PSD file collapsed when set to false overrides the single raster default loading layers loads the specified layers Specify the layers to collapse and the order in which to collapse them The layer numbers begin at 0 background and go up To specify all layers including non visible layers use the wild card notation The visibleOnly function may used to load only the visible layers of a PSD file NOTE MediaRich loads only the image data from the layers and ignores all other effects To preserve such effects merge the effects into the layer data in Photoshop You can specify the layers out of order and they are composited accordingly The layer list must be contained in quotes and consists of comma separated entries You can specify ranges 0 2 or individual layers 0 2 NOTE When you specify a comma separated list of layers do not leave any spaces after the commas If the Photoshop file has named layers you can use the layer names up to 31 characters in place of layer numbers You can also use the as a wildcard when specifying layers For example image load name horizontal psd layers B This line of script loads all layers whose names begin with B such as Boy Baseball Ballcap and so on The layers command is case sensitive so the example line of script will not flip l
162. owing img save name out jpg quality 90 Using MediaScript 13 File Systems 14 Chapter 2 All of the functions that use named arguments also accept a single object as an argument If an object is passed each of the object s properties corresponds to an argument name value pair the property s name is the argument name and the property s value is the argument value For example the previous MediaScript could be rewritten as the following var argsObject argsObject name out jpg argsObject quality 90 img save argsObject The advantage of passing an object is that it can be reused across multiple calls As a final option you can use ECMAScript s standard object literal syntax to pass a temporary anonymous argument object In this case the MediaScript would be rewritten as img save name out jpg quality 90 MediaRich for SharePoint server implements its own virtual file system for reading and writing data This file system is fully customizable allowing advanced installations the ability of defining various input and output repositories for specific purposes Mediakich was designed to support large clusters of servers to maximize performance and reliability There are two deployment scenarios for a MediaRich cluster In one scenario all of the servers share a common file system with shared properties originals and generated output files In the other scenario each MediaRich server maintains s
163. p middle bottom gt Angle lt angle gt Smooth lt true false gt SmoothFactor lt 0 4 gt BaseLine lt true false gt spacing lt or gt Kern lt true false gt Line lt value 0 1 to 10 gt Blend lt blend type gt Tile lt true false gt Append lt true false gt ClearType lt true false gt windows only Dpi lt 0 0 10000 0 gt b Parameters Font specifies the TrueType or PostScript font family name to be used for example Arial MediaRich supports Type 1 pfa and pfb PostScript fonts only NOTE The size of the font in pixels is dependent on the resolution of the resulting image If the resolution of the image is not set zero the function uses a default value of 72 DPI The default location for fonts specified in a MediaScript is the fonts file system Which includes both the MediaRich Shared Originals Fonts folder and the default system fonts folder If a MediaScript specifies an unavailable font MediaRich generates an error NOTE You can modify the MediaRich server s local properties file to change the default fonts directory See the MediaRich Administrator s Guide for more information Style specifies the font style You can use any combination of modifiers Each modifier should be separated by a space character NOTE The Style parameter is not available if MediaRich is running on Mac Linux or Solaris Weight modifiers modify
164. page 129 Syntax pixellateFragment Radius lt value 1 16 gt i Parameters Radius determines the extent of the offset with 1 indicating the minimum offset The default is 4 Example var image new Media image load name peppers tga image pixellateFragment Radius 2 image save type jpeg MediaScript Objects and Methods 113 114 Chapter 3 pixellateMosaic Pixellates the image with pixel size determined by the Radius parameter NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax pixellateMosaic Size lt 2 64 gt i Parameters Size determines the resulting pixel size The default is 8 Example var image new Media image load name peppers tga image pixellateMosaic Radius 10 image save type jpeg polygon Draws and positions a polygon on the image based on the specified parameters This method accepts all composite parameters except HandleX and Handley The foreground color may vary with this function depending on the original Media object If the object has a set foreground color or it is set with the setColor function MediaRich uses the set color However if the object has no set foreground color MediaRich does the following e For objects with 256 colors or le
165. parameters Saturation specifies the value used for weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize FixAlpha if set to true this is equivalent to applying the ixAlpha command It may be required with some images to get the expected results PreserveAlpha when set to true preserves the alpha channel of the target image as the alpha channel of the resulting image The default is false IgnoreAlpha when set to true the source is composited onto the target and alpha channel information is ignored The default is false X and Y specify the position of the source image with the center as anchor point For example if x 100 y 50 is specified the center of the source image will be located at pixel 100 50 on the target image If these parameters are not specified the center of the source image is located at pixel 0 0 HandleX and HandleY specify the attachment point of the source image The default values are center and middle Tile when set to true the source image wraps continuously along both the x and y axis so that it spans the entire target image The tiling starts in the location specified by the x a
166. ple if an image was licensed to a publication for a one time use the Transaction ID can be used to track that specific licensing transaction vs the same image licensed to a different customer for 1 year of use If no Transaction ID is desired set the Transaction ID to zero Valid for the following type transaction These are the copyright years that are embedded in the image One or both of these fields can be empty zero Valid for the following type copyright Indicates that image contains adult content when set to TRUE The default value is false empty Valid for all types Indicates that image has restricted use when set to TRUE The default value is false empty Valid for all types Indicates that image should not be copied when set to TRUE The default value is false empty Valid for all types Indicates the amount of energy of the watermark between 1 and 16 The higher the durability value the more robust the watermark The default value is 8 Valid for all types Example var image new Media image load name peppers tga image digimarcEmbed Type transaction CreatorID 404407 CreatorPin 32 DistributorID 2591 DistributorPin 1355 TransactionID 667 Adult true Restricted true CopyProtected true Durability 16 image save type jpeg discard Removes the designated Media object from memory This function fully supports CMYK image operations
167. r such that areas displayed as white on the monitor are printed with no ink This is termed white point mapping Color Profiles Color profiles for a given device can typically be obtained from the device manufacturer or may come installed on the operating system Additionally software is available that can be used to characterize a device and create a color profile The TIFF JPEG EPS and Photoshop image formats have the ability to store the color profile that describes the image contents along with the image This is termed an embedded profile MediaScript reads embedded profiles from these image formats and will preferentially use these profiles as the source for color transformations Additionally MediaScript has the ability to save the embedded profile along with the image data Rendering Intent Because of differences in color gamut and white point between differing devices building a transformation between devices requires the user to specify how to handle gamut and white point mapping This is specified as the rendering intent The ICC provides four different intents e Perceptual Relative Colorimetric e Absolute Colorimetric e Saturation Perceptual This intent specifies that the white points of the differing device be mapped and that color differences for out of gamut colors be preserved This implies that some compression of colors that lie inside both gamut be performed to make room for different out of g
168. rameters list Returns an array of File objects representing the directory entries for the named File object If the named File object does not represent a directory or that directory is empty then list returns an empty array Syntax lt object name gt list Parameters This function takes no parameters mkdir Creates the directory and any non existent parent directories specified by the current File object Syntax lt object name gt mkdir Parameters This function takes no parameters read Reads the specified line number from the file and returns it as a string NOTE Line numbers start at zero not at one Syntax lt object name gt read lt index gt i Parameters index specifies the line number and can range from 0 to 16 777 215 readNextLine Reads the next line from the file pointed at by the File object and returns a string containing the text in that line Returns undefined at the end of the file Syntax lt object name gt readNextLine Parameters This function takes no parameters remove Deletes the filename for the File object Syntax lt object name gt remove Parameters This function takes no parameters rename Renames the File object changing the name property of the object to the new name Syntax lt object name gt rename lt newname gt Parameters newname a string containing the new name property The string must be in quotes If t
169. rd tomjones apassword File Caching The process of reading a file over a network can be time consuming For this reason files read via the FTP and HTTP protocols are stored in a local file cache Subsequent accesses to the same file that occur shortly after the file was last downloaded are served from the cache rather than reread from the network The RefreshInterval property determines how HTTP and FTP files are cached This value is interpreted as a time interval in seconds and indicates how often MediaRich should check witha HTTP or FTP server to determine if a newer version of a file exists The default value of this property is 900 or 15 minutes If the value of the RefreshInterval property is set to a negative value then caching is disabled and every HTTP or FTP request retrieves a file from the network Unless caching has been disabled caching behavior works according to the following sequence of events whenever a file is requested via HTTP or FTP MediaRich first looks to determine if the same file exists in the local cache e If the file does not exist in the cache MediaRich fetches the file e If it does exist MediaRich computes the age of that file how long it has been since that file was last updated Ifthe age of the file is less than that specified using the RefreshInterval property MediaRich uses the cached file Ifthe age of the file is greater than that specified using the RefreshInterval property MediaRich co
170. ree located somewhere on either the local filesystem or on the network When referencing a file via a virtual file path the virtual filesystem on which the file is located is specified by prepending the virtual filesystem name followed by a colon onto the path to that file The FSNet plug in can implement HTTP and FTP access via standard URLs by defining virtual filesystems named http and ftp Since normal HTTP and FTP URLs consist of these names followed by a colon and then followed by a file path normal HTTP and FTP URLs are valid MediaRich virtual file paths In addition to the default http and ftp filesystems it is possible to set up other filesystems that refer to resources on HTTP and FTP servers These URLs would look the same as the standard URLs except that the http or ftp keys at the beginning of the URLs would be some other name to specify that an alternate filesystem is being accessed For more information about defining additional HTTP and FTP filesystem see Defining Additional FSNet Virtual Filesystems on page 19 Enabling Standard HTTP and FTP URL Access To allow standard HTTP URLs to be passed to MediaRich as file paths add the following line to MediaRich s local properties file filesystem fsnet http Specifier http To allow standard FTP URLs to be passed to MediaRich as file paths add the following line to the local properties file filesystem fsnet ftp Specifier ftp filesyste
171. required There is no default value Opacity specifies opacity of the drawn object The default value is 255 completely solid Unlock when set to true causes the arc to display only where the specified color value appears in the current background image The default is false Color sets the color of the ellipse Index if a color palette exists for the source image use this parameter to set the color of the arc as an alternative to the Color parameter NOTE You cannot enter values in both the Color and Index fields Saturation specifies a value for the weighting for the change in saturation for destination pixels A value of 255 changes the saturation of pixels to the specified color A value of 128 changes the saturation of a pixel to a mid value between the pixel s current color and the specified color NOTE The Saturation parameter only functions when the Blend parameter is set to colorize PreserveAlpha when set to true preserves the alpha channel of the target image as the alpha channel of the resulting image The default value is false Blend specifies the type of blending used to combine the drawn object with the images Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn
172. rgument must be one or more of the following predefined constants bitwise OR ed together e IccProfile MONITOR e IccProfile SCANNER e IccProfile PRINTER MediaScript Objects and Methods 155 156 Chapter 3 e IccProfile LINK e IccProfile ABSTRACT e IccProfile COLORSPACE e IccProfile NAMEDCOLOR e IccProfile UNKNOWN Parameters colorspace gt Bitwise OR of desired colorspace values class gt Bitwise OR of desired profile class values Example The following code gets an array of all the ICC monitor and printer profiles for RGB and CMYK colorspaces link IccProfile dll var profs IccProfile list IccProfile RGB IccProfile CMYK IccProfile MONITOR IccProfile PRINTER ICC Profile Object Methods The ICC Profile Object implements the following methods e IccProfile Constructor getName e getPath e getClass getColorspace getConnectionspace e close NOTE For all paths in the IccProfile Object that do not specify a file system the default is the color file system See File Systems on page 14 for more information IccProfile Constructor for IccProfile object Does not return a value Parameters Profile path to an ICC profile file or a media object with an embedded profile NOTE The special profile names rgb and cmyk may be used to denote the default RGB and CYMK profiles specified in the global properties fil
173. rmation from the system so the next thing to do is get this information var saveParams resp getSaveParameters This makes use of another object provided by the system the Response object named resp that is available to all MediaScripts and gets its save parameters The next line sets a save parameter saveParams type jpg Setting the save parameter type determines what type of image the framework is going to save The save parameters correspond to the parameters that can be passed to the Media object s save method For some formats such as GIF and JPEG there are many more parameters that can be specified NOTE For more information about what parameters are available for saving images see save on page 124 Before returning control to the framework you must complete a final step resp setSaveParameters saveParams This line sets the save parameters with the instance altered in the script return image This last line returns the Media object named image for the framework to use in the response applying the response s save parameters Deploying a New MediaScript To deploy a MediaScript copy the file to the appropriate directory In a default installation the directories are For Export MediaRich Root Shared Originals Scripts SharePoint Export For the MediaCart MediaRich Root Shared Originals Scripts SharePoint Batch NOTE These directories are set duri
174. ro The second parameter specifies the position of the selected layer along the x axis of the composite image with the layer s center point used as the anchor point For example a value of 50 positions the center point at pixel 50 on the x axis of the composite image Example var image new Media image setLayerX 2 50 setLayerY Sets the Y composite offset of the media layer with the specified index if available Syntax lt object name gt setLayeryY lt layer index gt lt position gt Parameters The first parameter specifies the desired layer index starting from zero MediaScript Objects and Methods 137 138 Chapter 3 The second parameter specifies the position of the selected layer along the y axis of the composite image with the layer s center point used as the anchor point For example a value of 100 positions the center point at pixel 100 on the y axis of the composite image Example var image new Media image setLayerY 2 100 setLayerPixels Sets the image in the specified layer of the current media to the specified raster Syntax lt object name gt setLayerPixels lt layer index gt lt media gt Parameters layer Index the index of the layer to be replaced This must exist in the current image media the raster to use as the replacement This must consist of a single raster setMetadata Attaches metadata specified by data to the image for the specified
175. rs dir specifies the VFS path of the directory to extract files MediaScript Objects and Methods 161 firstFile Resets file iterator to first file in archive Returns a string with the name of current file or null if not found Parameters This function takes no parameters nextFile Advances file iterator to next file in archive Returns a string with the name of current file or null if not found Parameters This function takes no parameters getFileName Returns name of current file in archive Parameters This function takes no parameters extractFile Extracts the current file to the specified file Parameters destFile specifies the VFS path of the destination file close Closes archive file Parameters This function takes no parameters Examples var myZip new Unzip myZip open zip files zip myZip extractAll files myZip close 162 Chapter 3 To extract each file individually var myZip new Unzip myZip open zip files zip var filename myZip firstFile whil filename null myZip extractFile files filename filename myZip nextFile myZip close Global Functions MediaRich supports all the basic ECMAScript capabilities including conditionals variables functions and exception handling as well as the proprietary image processing functions described here For information on functions and objects not described in this gu
176. rspace defined by the profile embedded in image If image has no embedded profile an exception is thrown Assuming the image is a cmyk image with an embedded profile the resulting color will be the rgb color corresponding to color NOTE Ifa Color Profile is associated with an RGB image this is considered unnecessary data and by default the attached profiles will not be saved to RGB images For more information please see Appendix B MediaRich Color Management colorTolmage The specified color is converted from the colorspace defined by the source profile to the colorspace defined by the destination profile and returned to the caller By default the destination profile is the profile embedded in the image The specified rendering intent is used for the conversion A destination profile may be supplied and will be used if the image has no embedded profile or if the OverrideEmbedded parameter is specified as true Syntax colorToImage color lt color in hexadecimal rgb or cmyk gt destProfile lt filename icc gt sourceProfile lt filename icc gt intent lt rendering intent gt Parameters color specifies the to color to convert using its hexadecimal or rgb value sourceProfile specifies the profile used for the source colorspace destProfile specifies the profile used for the destination colorspace if the image has no embedded profile or if the overrideembedded flag is set to true NOTE
177. s Media NOTE You can modify the MediaRich server s local properties file to change the default Media directory See File Systems on page 14 for more information MediaRich also allows you to set up virtual file systems and then load files from that location Virtual file systems are defined in the MediaRich server s local properties file For example if you define XML to represent the path C 010102 xML in the local properties file you can use files from the XML directory with the loadFile function XMLDoc loadFile XML customersUS xml loadString Loads an XML file as a string rather than as a file Syntax lt object name gt loadString lt XML string gt i Parameters This function accepts an XML string as its only parameter The string must include valid XML start and end tags Example var test new XMLDocument test loadString lt html gt sale lt html gt save Saves an XML document to the file system Syntax lt object name gt save lt filename xml virtualfilesystem filename xml gt 3 MediaScript Objects and Methods 151 Parameters This function accepts an XML filename as its only parameter By default MediaRich saves XMLDocument files in the write file system which point to the following directory MediaRich Shared Originals Media NOTE You can modify the MediaRich server s local properties file to change the default Media direc
178. s are disabled by default To configure the file systems you need to add entries to the local properties file The basic entries required to enable both file systems are filesystem fsnet http Specifier http filesystem fsnet ftp Specifier ftp filesystem fsnet ftp FTP 1 The following table lists the properties you can configure for either FTP or HTTP Property Disabled Specifier UserName Password UserNameAndPassword FTP ProxyHost ResponseTimeout LockTryDelay MaxTries BreakLockOnFailure RefreshInterval Usage Set to 1 to disable the file system 0 or no entry to enable it This is the path specifier that denotes this file system Sets the default user name Sets the default password Sets the default username and password separated by Set to 1 to use FTP protocol 0 or no entry to use HTTP Set as proxyServerNameOrIP port to configure a HTTP proxy server HTTP only Specifies the amount of time to wait for a response from a server before giving up Specifies the amount of time to wait in seconds when a cache file is locked Specifies how many times to retry a locked cache file before giving up Set to 1 break a lock on a cache file if the lock fails to become available Specifies how often in seconds to check the web for a newer image Using MediaScript 21 22 Chapter 2 Chapter 3 MediaScript Objects and Methods MediaScript includes a number of built in objects that yo
179. s using media stored in Microsoft SharePoint Portal Server It includes an out of the box interface where users perform these tasks using either the Export interface which is available from MediaRich Document Libraries or the MediaRich MediaCart site which is available from the MediaRich Browser To fit the needs of your organization and users you can customize the MediaRich Document Libraries and MediaCart site using standard SharePoint tools and MediaRich s proprietary scripting language MediaScript This guide provides information about extending these interfaces by adding new MediaScripts For more information about the MediaRich for SharePoint architecture deployment and administration see the MediaRich for SharePoint Installation and Administration Guide And for more information about the default implementation of the MediaRich Document Libraries and MediaCart site see the MediaRich for SharePoint User Guide Chapter Summary MediaRich for SharePoint 2003 Features 6 The Application Programming Framework 7 MediaRich for SharePoint 2003 Features 6 Chapter 1 File Format Support MediaRich for SharePoint extends SharePoint s standard picture library to provide previews of CMYK images Vector images and layered Photoshop files along with related metadata It reads and writes many popular file formats including BMP WBMP GIF JPG PNG PCT TIFF PDF TGA Adobe Illustrator and Photoshop PSD or EPS files Workf
180. sets the response file path If the path does not specify a file system the default is the read file system See File Systems on page 14 for more information RespType optional parameter that sets the response type RespType Cached the default saves the response object or file to the MediaResults cache directory so that future requests are returned directly by the filter RespType Streamed bypasses the cache and returns the response data directly to the filter RespType Path returns the full native path of a file to the filter but does not copy the file to the cache For more information see setResponseType on page 39 Example var img new Media img load name foo jpg img save name bar gif type gif resp setPath bar gif RespType Path getPath Returns the path of the current response Media object Parameters This function takes the name of a Media object as its only parameter Syntax resp getPath lt Media object gt setMedia Sets the response Media object to the specified object Parameters This function takes the name of a Media object as its only parameter Syntax resp setMedia lt Media object gt getMedia Returns the current response Media object Syntax resp getMedia Parameters This function has no parameters setResponseType Sets the response type Syntax resp setResponseType RespType Parame
181. sformation between the source profile and the destination profile This transformation is then used to convert each pixel in the image from the source device to the destination device Detailed information regarding ICC color management can be found at the ICC web site Colorspaces Different color reproduction devices use different types of color representation colorspaces for color reproduction Most color reproduction devices fall into three basic categories Each category is represented by a different image colorspace Grayscale colorspace devices use a single intensity corresponding to the darkness lightness desired In MediaScript a grayscale value of 0 represents black while a grayscale level of 255 represents white RGB colorspace devices typically monitors use red green and blue intensities which combine to form the color The value combined additively when all three components are 0 the color is the darkest the device can represent and when all three components are 255 the color is the brightest CMYK colorspace devices typically printers use the intensity of the cyan magenta yellow and black inks to represent the color When no ink is used all components 0 the color is the color of the paper When the maximum intensities are used the color is at its darkest Note that most printers cannot print using the maximum value of all four channels Converting colors between these different types of devices fundamentally
182. spectively These names are case sensitive NOTE A save function will embed a color profile for a color profile supporting format without explicitly setting saveMetadata to true only when CMYK data is present The _MR_Metadata Object The _MR_Metadata object supports extracting metadata from supported file formats without loading the image data It also supports merging new metadata into existing files without the need to interpret or decompress the image data The _MR_Metadata object has two methods save and load In addition the _MR_Metadata object can be used as the MediaScript response object allowing the script to stream back a file with modified metadata Appendix A The MR Metadata constructor takes a file name and an optional file type var metaObj new MR Metadata myimage jpg jpeg If the file has a valid extension the file type may be omitted The _MR_Metadata save command provides a single object as a parameter in a manner similar to the Media object save command This parameter may be specified as an object or using the ampersand notation The parameters for the save command object are exif iptc xmp and name The file type of the result is always the same as the file type of the original image metaObj save exif myExifDoc iptc null xmp null name newFile or var saveObj new Object saveObj iptc null saveObj xmp null saveObj exif myExifDo
183. ss MediaRich uses the last color index e For objects with 15 bit or greater resolution MediaRich uses white NOTE Using polygon to mask frames within a JavaScript for loop can result in initially poor anti aliasing To maintain optimal anti aliasing place the masking polygon outside the loop Syntax polygon Points lt x yiX YiX YixX y gt Opacity lt value 0 255 gt Unlock lt color in hexadecimal or rgb gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Saturation lt value 0 255 gt PreserveAlpha lt true false gt Blend lt type gt Width lt value gt Smooth lt true false gt Fill lt true false gt Parameters Points describes each point of the polygon using absolute coordinate points Each pair of coordinates is separated from the next by a semicolon This parameter is required and has no defaults NOTE To create a closed polygon the first set of coordinates and the last set of coordinates must be identical For example the parameter Points 16 20 180 160 120 229 16 20 describes a closed triangle Opacity specifies opacity of the drawn object The default value is 255 completely solid Unlock if set to true causes the polygon to display only where the specified color value appears in the current background image The default is false Color sets the color of the polygon If a color palette exists for the sour
184. t renderer will be used if available DPI specifies the DPI used for text rendering The default value is 72 NOTE The DPI parameter is not available if MediaRich is running on Mac Linux or Solaris Example var image new Media image load name logobg tga image drawText Font Arial Style Bold Text MediaScript Breakthrough Technology Size 18 Color 0x0000FF x 185 y 30 Smooth true Kern true image save type jpeg MediaScript Breakthrough Technology dropShadow Adds a drop shadow to the image based on its alpha channel The effects are best seen when compositing the results onto another image This function fully supports CMYK image operations NOTE Occasional unexpected results can often be corrected with the fixAlpha command See fixAlpha on page 80 for more details Syntax dropShadow ResizeCanvas lt true false gt layers lt layer list gt PSD files only Opacity lt value 0 255 gt Blur lt value 0 30 gt Dx lt number of pixels gt Dy lt number of pixels gt Color lt color in hexadecimal or rgb gt Index lt value 0 16777215 gt Parameters ResizeCanvas provides for the canvas of the image to be automatically enlarged to encompass the shadow produced The image s background color will be used for the additional area For more information about setting an image s background color see
185. tadata gt Use if the format supports loading XMP metadata gt Use if the format supports saving XMP metadata var fileFormats Media getFileFormats Parameters This function takes no parameters Example This example returns a text file describing all of the available file formats include sys TextResponse ms function main var foo Media getFileFormats var txt new TextResponse for var i 0 i lt foo length i txt append fool i type n txt append exts fool i extensions n txt append flags if fool i flags amp Media FormatLoad txt append load if fool i flags amp Media FormatSave txt append save if fool i flags amp Media FormatCmykSave txt append cmyk txt append n resp setObject txt RespType Streamed getExtensionFromType Returns the file system extension such as jpg for the given the media type Syntax var extension Media getExtensionFromType lt W E ype ns Parameters type the media type such as jpeg tiff etc getTypeFromExtension Returns the media type for the given the extension Syntax var type Media getTypeFromExtension lt extension gt 3 MediaScript Objects and Methods 45 Parameters extension the file system extension whose type is desired such as psd Object Methods The Media object
186. tax lt object name gt getType Parameters This function has no parameters setText Sets the text string associated with this object Syntax lt object name gt setText lt text string gt Parameters This function takes only a text string which must be enclosed in quotation marks setTextType Sets the text type associated with this object must be one of the defines above Syntax var strObject TextResponse lt textType gt Parameters textType specifies the text type using one of the following predefined values e TypePlain saves text as a plain text file with extension txt TypeHtml saves text as an HTML file with extension html TypeXml saves text as an XML file with extension xml ICC Profile Object Dynamic enumeration of color profiles is provided by the IccProfile link library The library allows clients to list profiles by colorspace and class or to query a specific icc profile static function list colorspace class Static method of the IccProfile class that returns an array of icc profile files corresponding to the specified colorspace and class The colorspace argument must be one or more of the following predefined constants bitwise OR ed together e IccProfile RGB e IccProfile CMYK e IccProfile LAB e IccProfile XYZ e IccProfile GRAY e IccProfile ALPHA e IccProfile PALETTE e IccProfile HLS e IccProfile HSV The class a
187. ters RespType sets the response type RespType Cached saves the response object or file to the MediaResults cache directory so that future requests are returned directly by the filter e RespType Streamed bypasses the cache and returns the response data directly to the filter RespType Path the default returns the full native path of a file to the filter but does not copy the file to the cache Example var img new Media img load name foo jpg img save type gif resp setResponseType RespType Streamed getResponseType Returns the response type previously set by setPath setObject or setResponseType NOTE If no response path is set the function returns null Syntax var respType resp getResponseType Parameters This function has no parameters MediaScript Objects and Methods 39 40 Chapter 3 setSaveParameters Sets the response save parameters for the response media object Syntax resp setSaveParameters lt save parameters gt Parameters save parameters specified as either an object or in the standard syntax for example type jpeg These parameters are passed directly to the Media object save method For a description of these parameters see save on page 124 getSaveParameters Returns the current save parameters for the response Media object Syntax resp getSaveParameters Parameters This function has no p
188. th gt Parameters Source specifies the image to add by its user defined Media object name layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 Rtype specifies the target bit depth The supported bit depths RGB 24 RGBA 32 CMYK 32 CMYKA 40 Gray 8 RGB 15 RGB 16 RGBA 16 RGB 18 Alpha 8 HLS 24 HSV 24 Valid channel names are e Blue Green Red Alpha e Cyan Magenta Yellow Black CMYK space e Brightness Saturation Hue HSV space e Brightness2 Saturation2 Hue2 HLS space The default value is Blue NOTE If you attempt to import an alpha channel into a 24 bit image it will automatically be converted to a 32 bit image Example var imagel new Media var image2 new Media imagel load name peppers tga image2 load name Bears tga image2 scale xs imagel getWidth ys imagel getHeight imagel importChannel channel red source image2 imagel save type jpeg MediaScript Objects and Methods 97 98 Chapter 3 infoText Returns the information about text Syntax infoText font lt font gt size lt size gt style lt style gt Return Values ascent the font as
189. the background color as an index value Direct indexing is primarily used for indexed images but can be used for any image type to select a specific pixel value Foreindex specifies the foreground color as an index value Transparency if this parameter is set to false the whole image is considered opaque If set to true the pixels in the image that match the background color are considered transparent Transparency is typically used when generating an alpha channel for an image such as compositing an image that is not 32 bit Transparency is also supported when saving to the GIF format and if 8 bit or less to the PNG format Popular if set to true finds the most popular color or index in the image For images above 16 bit color depth the image is processed at 18 bit resolution NOTE The Popular parameter overrides any settings specified by the Backcolor Forecolor Backindex or Foreindex parameter In addition this parameter does not support the CMYK color space Precise If Popular is specified and this is set to true the method uses precision in the calculation of the most popular color If set to false default the color returned will be a close approximation of the actual color that appears most often in the image layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image
190. the type of blending used to combine the drawn object with the images Blend options are Normal Darken Lighten Hue Saturation Color Luminosity Multiply Screen Dissolve Overlay HardLight SoftLight Difference Exclusion Dodge ColorBurn Under Colorize causes only the hue component of the source to be stamped down on the image and Prenormal Width specifies the thickness in pixels of the line The default is 1 Smooth when set to true makes the edges of the line smooth preventing a pixellated effect The default is false Example var image new Media image load name logobg tga image line X1 45 Y1 15 X2 135 Y2 90 Width 3 image line X1 135 Y1 60 X2 135 Y2 90 Width 3 image line X1 105 Y1 90 X2 135 Y2 90 Width 3 image save type jpeg load Loads an image into the Media object from the specified file The following file formats support the CMYK color space psd tif and jpg NOTE In MediaRich version 3 6 load no longer does any color conversion For instance additional parameters for Color Profile Specifications srcProfile dest Profile and intent parameters are no longer supported You must now explicitly call convert or colorConvert to change the type of an image Syntax load name lt f
191. ther Style parameters are Underline Italic or Italics and Strikethru or Strikeout NOTE You can combine Style parameters For example Style Bold Italic Text specifies the text to be drawn The text string must be enclosed in quotes To indicate a line break insert n into the text Size the point size of the font to be used The default size is 12 Justify specifies how the text will be justified The default is center Other options are left right and justified This parameter only affects text with multiple lines Wrap if specified uses the value to force a new line whenever the text gets longer than the specified number of pixels in this case correct word breaking is used Line specifies the line spacing The default spacing between lines of text is 1 5 Smooth specifies that the text is drawn with five level anti aliasing Spacing adjusts the spacing between the text characters The default is 0 A negative value draws the text characters closer together Kern if set to true optimizes the spacing between text characters By default this is set to true If you do not want to use kerning this must be specified as false NOTE PostScript fonts store the kerning information in a separate file with a afm extension This file must be present in order for kerning to be applied to the text ClearType if specified as true the Windows
192. ther options are image transaction and copyright The type determines which set of additional parameters that are valid for the watermark A number which uniquely identifies the creator of the image The creator ID maps to a profile of the creator at the Digimarc MarcCentre website Valid for the following types basic image transaction and copyright This is a unique Personal Identification Number PIN issued with the associated CreatorID This value is used by DWM to check the validity of the CreatorID Valid for the following types basic image transaction and copyright Identifies the organization that distributes the image This is a numeric value and can be DistributorID may be set to zero to indicate that no distributor ID is to be placed in the watermark Note that if a DistributorID of zero is specified then the CreatorlD above should not be zero Valid for the following types image transaction and copyright This is a unique Personal Identification Number PIN issued with the associated Distributor ID This value is used by DWM to check the validity of the Distributor ID Valid for the following types image transaction and copyright This a 24 bit number that uniquely identifies the image similar to an image catalog number If no image ID is desired set the image ID to zero Valid for the following type image This is a 24 bit number that uniquely identifies an instance of the image For exam
193. this information so this function is primarily used in internal calculations in conjunction with other functions such as arc and drawText and supports the CMYK color space When an image is initially loaded into memory the foreground and background colors are initialized according to the following order of precedence e For indexed images Background color will be index 0 Foreground color will be the last indexed color MediaScript Objects and Methods 131 132 Chapter 3 e For all other images Background color will be black Foreground color will be white NOTE If the image s file type supports them and its background transparency and or foreground colors have been set those values will be used Unless specifically changed the initial values will be retained and used throughout all subsequent transformations To be sure of the values used it is best to use specific settings Syntax setColor BackColor lt color in hexadecimal or rgb gt ForeColor lt color in hexadecimal or rgb gt BackIndex lt value 0 16777215 gt ForeIndex lt value 0 16777215 gt Transparency true false Popular true false Precise lt true false gt layers lt layer list gt PSD files only Parameters Backcolor specifies the background color as a specific RGB or hexidecimal value Forecolor specifies the foreground color as a specific RGB or hexidecimal value Backindex specifies
194. ting the Response Contents 30 Response Types 31 HTTP Response Methods 36 Media Object 43 Class Methods 43 Object Methods 46 XmIDocument Object 150 XmlIDocument Object Properties 150 XmlIDocument Object methods 150 The System Object 152 Appendix A Appendix B Text Response Object 153 TextResponse Object Methods 153 ICC Profile Object 155 static function list colorspace class 155 ICC Profile Object Methods 156 IccProfile dll 159 Zip Object 160 Zip Profile Object Methods 160 Unzip Object 161 Unzip Profile Object Methods 161 Global Functions 163 Working with Media Processing Functions 163 MediaScript Global Functions 164 RgbColor Object 167 MediaRich Metadata Support 169 Low Level Metadata Interface 170 The Media Object 170 The _MR_Metadata Object 170 High Level Support for Exif and IPTC 172 Common Metadata Methods 172 IPTCMetadataObject 173 The Exif Metadata Object 177 MediaRich Color Management 181 Color Management Overview 182 Colorspaces 182 Color Gamut 182 White Point Mapping 183 Color Profiles 183 Rendering Intent 183 MediaScript Color Management Functions 184 Image Conversion Methods 184 Profile Management methods 185 Specifying Profiles 186 Accuracy and Reversibility of Color Conversions 186 Common Color Management Questions 187 Index 189 Chapter 1 Programming MediaRich for SharePoint Mediakich for SharePoint is a client server system that allows users to perform image processing task
195. tion aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 MediaScript Objects and Methods 111 112 Chapter 3 Syntax otherMaximum Radius lt value 1 10 gt Parameters Radius determines the extent of the effect The default is 1 minimal effect Example var image new Media image load name peppers tga image otherMaximum Radius 2 image save type jpeg otherMinimum Replaces the pixels within the radius with the darkest pixel in that radius thereby amplifying the darker areas of the image NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax otherMinimum Radius lt value 1 10 gt i Parameters Radius determines the extent of the effect The default is 1 minimal effect Example var image new Media image load name peppers tga image otherMinimum Radius 2 image save type jpeg pixellateFragment Makes and offsets four copies of the image NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on
196. tory See File Systems on page 14 for more information MediaRich also allows you to set up virtual file systems and then save files to that location Virtual file systems are defined in the MediaRich server s local properties file For example if you define XML to represent the path C 010102 XML in the local properties file you can use files from the XML directory with the save function XMLDoc save XML customersUS xml The System Object 152 Chapter 3 The System object provides access to system information and implements the following methods fontExists Returns true if a font with the specified name exists It takes the font name as its only parameter getFontList Returns an array containing the names of all fonts known by the system Text Response Object The TextResponse objects allow users to create response objects that take strings and save text files plain text html or xml TextResponse Object Properties There are no properties for this object TextResponse Object Methods The TextResponse Object implements the following methods TextResponse e append getText getTextType e getType setText setTextType TextResponse The TextResponse object needs to be constructed using the new TextResponse constructor Syntax var strObject TextResponse lt textType gt Parameters textType
197. transparent of the padded area s alpha channel This parameter is useful when the cropped image is used in a composite NOTE If the cropped image is not 32 bit before cropping the transparency information is not used on the next composite function TransparentCutof f specifies a value that controls the selection of the transparent pixel when scaling images with color palette If the scaled alpha channel value is less than or equal to the transparentCutoff value the transparent pixel is selected A value of 1 default ignores the scaled alpha value and performs the normal reverse color lookup Example var image new Media image load name pasta tga image scale xs 75 constrain true image save type jpeg selection Creates a selection from the specified Media object The selected area can be thought of as a grayscale image or alpha channel that determines the way in which a given transform is applied to an image Where the selection is 255 the transform or function is applied to the image pixel where the selection is zero the transform is not applied In cases where the selection is between 1 and 254 the transform is applied to the source pixel and the result is then blended with the original pixel based on the selection value This function also fully supports the CMYK color space NOTE If using with two source images both images must be the same size This can be accomplished with the scale
198. ts will have default values when used as input parameters e Gray gt Gray 8 e RGB gt RGB 24 e RGBA gt RGBA 32 e HSV gt HSV 24 e HLS gt HLS 24 e CMYK gt CMYK 32 e CMYKA gt CMYKA 40 NOTE Deprecated parameters include Grayscale 15 bit 16 bit 16a bit 24 bit 32 bit Dither determines the level of dithering to use for remapping image pixels to a lower bit depth PreserveBackground when dithering is used eliminates any pixels in the source image that match the background color from the dithering process in the destination image This can be used to eliminate fuzzy edges for an object against a solid color background layers for PSD files specifies the layers to be converted Specify the layers to collapse and the order in which to collapse them The layer numbers begin at 0 background and go up For more information see load on page 101 Example var image new Media image load name peppers tga image convert rtype Grayscale dither 5 image save type jpeg convolve Convolves the image with the specified filter Syntax convolve filter lt filter list gt Parameters filter specifies the standard filter to be applied Available filters are e Blur standard blur filter e Smooth standard smooth filter e Sharpen standard sharpen filter e Emboss1 standard emboss filter e Emb
199. turns the CountryCode Sets the CountryCode Returns the CountryName Sets the CountryName Returns the OriginalTransmissionReference Sets the OriginalTransmissionReference Returns the Headline Sets the Headline Returns the Credit Sets the Credit field Returns the Source field Sets the Source field Returns the Copyright field Sets the Copyright field Returns an array of Contact elements Sets Contact elements Adds Contact elements Sets Contact element from an Array Method getCaption setCaption string getWriter setWriter string addWriter string setWriterArray array getiImageType setImageType string getImageOrientation setImageOrientation string getLanguageldentifier setLanguageldentifier string The Exif Metadata Object Description Returns the Caption element Sets the Caption element Returns an array of writer elements Sets Writer elements Adds Writer elements Sets Writer elements from an array Returns the ImageType Sets the ImageType Returns the ImageOrientation Sets the ImageOrientation Returns the Languageldentifier Sets the Languageldentifier The following methods may be used to get and set metadata values for Exif metadata Please refer the schema Exif xsd in the Shared Originals Sys folder for the required format for each of the Exif fields Note that only a brief description is provided here For a complete
200. turns the HandleX value left center or right of the media layer with the specified index if available HandleX refers to the selected layer s attachment point on the x axis Syntax lt object name gt getLayerHandlex lt layer index gt Parameters layer index specifies the desired layer index starting from 0 Example var image new Media image load name peppers psd if image getLayerHandlexX 0 Center aes getLayerHandleY Returns the HandleY value top middle or bottom of the media layer with the specified index if available HandleY refers to the selected layer s attachment point on the y axis Syntax lt object name gt getLayerHandley lt layer index gt e Parameters layer index specifies the desired layer index starting from 0 Example var image new Media image load name peppers psd if image getLayerHandleY 0 Middle ees getLayerindex Returns the index of the media layer with the specified layer name if available Syntax lt object name gt getLayerIndex lt layer name gt i Parameters The only parameter specifies the desired layer name Example var image new Media image load name peppers psd if image getLayerIndex GreenPepper 2 sac getLayerName Returns a string with the name of the media layer if available It takes the specified layer index startin
201. turns the query string portion of the MRL that originated the request everything after the Syntax var queryString req getQueryString Parameters This function has no parameters getScriptPath Returns a string containing just the query component of the URL used to generate the executing request Syntax req getScriptPath Parameters This function has no parameters Example If the original URL is http MRserver mgen fotophix photochange ms args 22pic3 jpg 22 is 80 50 amp p 4 1 then req ScriptPath returns fotophix photochange ms getJobld Returns an integer identifying the current job Note that this identifier is unique only to a specific MediaGenerator It is reset to start at 0 when the MediaGenerator is started and is incremented by 1 for each request processed See the NET or Java API documentation for a description of the MediaRich batch interface Syntax var id req getJobId Parameters This function has no parameters getBatchld Returns an integer identifying the Batch A batch is a collection of jobs sent to the Media Generator through the NET of Java APIs Note that this identifier is unique only to a specific MediaGenerator It is reset to start at 0 when the MediaGenerator is started and is incremented by 1 for each batch request See the NET or Java API documentation for a description of the MediaRich batch interface For non batch requests this identifier
202. u can use to customize your MediaRich requests and responses Chapter Summary Error Handling 24 File Object 24 Global Request and Response Objects 30 Media Object 43 XmIDocument Object 150 Text Response Object 153 ICC Profile Object 155 Zip Object 160 Unzip Object 161 Global Functions 163 23 Error Handling File Object 24 Chapter 3 Most MediaScript functions indicate an error condition by throwing an exception rather than returning an error code Exceptions can be trapped and handled using ECMAScript s standard try catch finally mechanism For example the Media object s load method throws an exception if the file to be loaded is not found To trap this exception you would write something like the following try img load name missingFile tga catch e Here you can recover from the error Possible actions include loading a default image logging an error or returning a 404 If an exception is thrown while executing your script and no catch block traps it the script will terminate immediately By default the error is logged to the ScriptErrors 1log file and returned to the client as an error response You can disable logging by setting the ScriptErrorLogging property to false in the global properties configuration file For HTTP clients you can disable the returning of the error response as HTML by setting the ReturnHtmlErrors property to false in global properties If error
203. update code getUrgency Returns the urgency code setUrgency string Sets the urgency code getSubjectReference Returns an array of subject references setSubjectReference string Sets subject references MediaRich Metadata Support 173 174 Appendix A Method addSubjectReference string setSubjectReferenceArray array getCategory setCategory string getSupplementalCategory setSupplementalCategory string addSupplementalCategory string setSupplementalCategoryArray array getFixtu setFixtu getKeywo setKeywo addKeywo setKeywo reldentifier reIdentifier string cds rds string rds string sea rdsArray array getContentLocation getCon getCon setCon addCon tent tentl tent tentLocationName which LocationCode which Location name code Location name code getReleaseDate setReleaseDate date setReleaseTime string getExpirationDate setExpirationDate date setExpirationTime string getSpecialInstructions Description Adds subject references to the list Sets a group of subject references from an Array Returns the category code Sets the category code Returns the supplemental category array Sets supplemental categories Adds a value to the supplemental category list Sets a group of supplemental categories as an Array Returns the fi
204. ur effect as the blurBlur function NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax blurMoreBlur Parameters There are no parameters for this function MediaScript Objects and Methods 55 56 Chapter 3 Example var image new Media image load name peppers tga image blurMoreBlur image save type jpeg blurMotionBlur Simulates the type of blur that results from motion as in the photo of a tree photographed from a moving car NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax blurMotionBlur Angle lt value 360 360 gt Distance lt value 1 250 gt Parameters Angle specifies the direction of the blurring motion The default is 0 level suggesting motion from left to right Distance specifies the intensity or motion speed of the effect The default is 10 Example var image new Media image load name peppers tga image blurMotionBlur Angle 30 Distance 10 image save type jpeg clone Copies one Media object into another After a Media object has been cloned both the original and t
205. ut not the other you will need to write separate commands Remove de activates any current selection Opacity alters the current level of transparency for the selection Applying an opacity level of 128 will increase the transparency level of the selection by 50 If reduced the level of the selection cannot be increased again Radius when the backcolor color index or color type parameter is also specified this parameter selects all pixels of colors most similar to the specified color using the specified color as the starting point and increases the range of similar colors included in the selection as the value for Radius increases The value for this parameter must be higher than zero For example image selection Color 0x008000 Radius 20 This example will create a selection consisting of all the colors in the image that are most similar to this color green within a radius of 20 layers for PSD files specifies the layers to be included The layer numbers begin at 0 background and go up For more information see load on page 101 Example var Target new Media var Source new Media Target load name peppers tga Source load name Bears tga Target selection source Source opacity 240 Target adjustHsb hue 75 saturation 75 Target save type jpeg setColor Sets the background color foreground color and transparency state of an image Very few formats support saving of
206. utline Best gt Constrain lt true false gt Xs lt pixels gt lt percentage gt Ys lt pixels gt lt percentage gt X1 lt pixels gt Y1 lt pixels gt X2 lt pixels gt Y2 lt pixels gt PreserveBackground lt true false gt PreserveBackgroundCutoff lt value 0 100 gt PadColor lt color in hexadecimal or rgb gt PadiIndex lt value 0 16777215 gt Transparency lt value 0 255 gt TransparentCutoff lt 1 0 255 gt 3 Parameters Alg specifies the algorithm that will be used The default algorithm is fast The outline algorithm is designed for black and white images only The effect of the best algorithm is most apparent when scaling upward it uses a spline algorithm giving superior results but is slower than both the fast and smooth algorithms Constrain specifies that the ratio between xs and ys is maintained relative to the original image If Xs and Ys values are specified and constrain is set to true the image size will be padded to preserve the aspect ratio of the source If the padColor parameter is not set then the padcolor is determined by the backcolor Xs and Ys specify the size of the generated image either as an absolute in pixels or as a percentage of the selection in the original Use X1 Y1 X2 and Y2 to specify the selected area If no area is selected the percentage is based on the original image size NOTE Putting
207. var i 0 i lt profs length i txt append profs i n var currProf new IccProfile profs i txt append name currProf getName n txt append path currProf getPath n txt append class currProf getClass n txt append colorspace currProf getColorspace n txt append connectionspace currProf getConnectionspace n currProf close resp setObject txt RespType Streamed MediaScript Objects and Methods 159 Zip Object 160 Chapter 3 The Zip object is used to create and add files to a new zip archive Zip Profile Object Methods The Zip Object implements the following methods e Zip Constructor addFile save NOTE For all paths in the Zip Object that do not specify a file system the default is the write file system See File Systems on page 14 for more information Zip Constructor for Zip object Parameters This function takes no parameters addFile Adds a file to the zip archive Note that the file is not actually read until the save method is called Parameters filePath specifies the VFS path of file to add to archive archivePath specifies a full path of file as stored in archive save Creates a new zip archive and compresses all the files specified by calls to addFile Parameters archiveName specifies a path to new archive file Example var myZip new
208. ve method without a name parameter For example img save type jpeg When the script terminates the contents of the img object are saved to the cache so that subsequent requests can be returned immediately without having to re execute the script The response contents can also be set explicitly using the response object s setObject method For example the previous example could be rewritten as resp setObject img RespType Cached type jpeg The response object can be any of the following types Media XmIDocument or TextResponse For more information about the setObject method see setObject on page 37 Finally the response contents can be set directly to the path of an existing file using the response object s set Path method For example to return a PDF file in the media directory named response pdf you would write resp setPath response pdf By default the file will be copied to the cache You can also stream the contents back to the client or just return the file path by setting the response type to one of the values listed in the following section Response Types There are three types of responses RespType Cached This is the default response type The response object or file is saved to the cache so that subsequent requests with the same parameters will be returned immediately from the cache The response in this case is the full path of the new cached file RespType
209. verted to the colorspace defined by the destination profile from the colorspace defined by the source profile and returned to the caller By default the source profile is the profile embedded in the image The specified rendering intent is used for the conversion A source profile may be supplied and is used if the image has no embedded profile or if the OverrideEmbedded parameter is specified as true Syntax colorFromImage color lt color in hexadecimal rgb or cmyk gt sourceProfile lt filename icc gt destProfile lt filename icc gt intent lt rendering intent gt Parameters color specifies the to color to convert using its hexadecimal or rgb value sourceProfile specifies the profile used for the source colorspace Use this parameter to define the color specified in the color parameter if the image has no embedded profile or if the OverrideEmbedded flag is set to true Otherwise the specified color is defined by the embedded profile destProfile specifies the profile used for the destination colorspace NOTE For more information see the section about specifying ICC profiles in colorCorrect on page 59 intent the rendering intent to use for the conversion This is an optional parameter Example rgbColor image colorFromImage color 0x00aaaa00 DestProfile rgb MediaScript Objects and Methods 61 62 Chapter 3 This example converts the color red to the colo
210. www w3 org TR 1998 REC DOM Level 1 19981001 NOTE If your MediaScript uses the Xmldocument object it must reference the xml ms file that installs with MediaRich using the include directive Include the following line at the beginning of your script include sys xml ms For more information about using the include directive see Using the include Directive on page 12 XmIDocument Object Properties The XmIDocument object has all the properties of the DOM s Document class as well as the loaded property loaded A Boolean property the value of which is determined by whether or not the XmIDocument is loaded Syntax lt object name gt loaded XmIDocument Object methods The XmlDocument object has all the methods of the DOM s Document class as well as the following methods new XmlDocument constructor e loadFile e loadString e save new XmIDocument The XmIDocument object needs to be constructed using the new Xm1Document constructor Syntax var Test new XmlDocument loadFile Loads an XML document from the file system Syntax lt object name gt loadFile lt filename xml virtualfilesystem filename xml gt Parameters The loadFile function accepts an XML filename as it s only parameter By default MediaRich looks for XMLDocument files in the write file system which point to the following directory MediaRich Shared Original
211. xture identifier code Sets the fixture identifier code Returns an array of keywords Sets keywords Adds keywords to the list Sets keywords from an Array Gets an array of content location objects Each object has two properties ContentLocationName and ContentLocationCode Returns the ContentLocationName subfield of the ContentLocation tag indexed by which Returns the ContentLocationCode subfield of the ContentLocation tag indexed by which Sets the ContentLocation tag to the specified name and code Adds the ContentLocation specified by name and code to the ContentLocation list Returns the ReleaseDate and ReleaseTime tags as a MediaScript Date object Sets the ReleaseDate and ReleaseTime tags from a MediaScript Date object Sets only the ReleaseTime field Returns the ExpirationDate and ExpirationTime fields as a MediaScript Date object Sets the ExpirationDate and ExpirationTime fields from a MediaScript Date object Sets only the ExpirationTime field Returns the Speciallnstructions field Method setSpecialInstructions string getActionAdvised setActionAdvised string getReference getReferenceService which getReferenceDate which getReferenceNumber service date number addReference service date number getDateCreated setDateCreated date setTimeCreated string getDigitalCreationDate setDigitalCreationDate date setDigitalCreationTi
212. yntax image noiseAddNoise Amount lt value 1 999 gt Gaussian lt true false gt Grayscale lt true false gt Parameters Amount indicates the intensity of the effect The default is 32 Gaussian toggles the Gaussian distribution effect on or off The default is false off Grayscale applies the monochromatic scale to the affected pixels The default is false normal color Example var image new Media image load name peppers tga image noiseAddNoise Amount 15 Gaussian true Grayscale true image save type jpeg otherHighPass Applies an effect opposite that of blurGaussianBlur it replaces each pixel with the difference between the original pixel and a Gaussian blurred version NOTE This function is selection aware so that if a selection has been made the system applies it based on the current selection For more information about making selections see selection on page 129 Syntax otherHighPass Radius lt value 10 250 gt i Parameters Radius specifies the radius of the Gaussian blur aspect of the effect The default is 10 Example var image new Media image load name peppers tga image otherHighPass Radius 50 image save type jpeg otherMaximum Replaces the pixels within the radius with the brightest pixel in that radius thereby amplifying the lighter areas of the image NOTE This function is selec
213. your MediaRich Administrator to enable this functionality type specifies the expected file type otherwise the type is derived from the file extension Valid type names are bmp eps flashpix gif jpeg png pict pex pdf photoshop ps tiff targa and wbmp NOTE Some image formats are module and or platform specific Please visit the support section of the Equilibrium website for the most current list MediaScript Objects and Methods 101 102 Chapter 3 detect indicates that if a matching file type is not found or if the load returns with a FileMangled or FileTypeWrong error the system will attempt to automatically determine the file s type and load it accordingly LoadMetadata if specified as true any Exif IPTC or XMP Metadata associated with the image is loaded The default is false For more information about MediaRich s metadata support see Appendix A MediaRich Metadata Support Default Page Range and Specification of Page Range for PS EPS and PDF dpi use this parameter for EPS PDF or PS source files to determine the size of the image after it is loaded The default is 72 In addition when loading one of these source files only the first page frame of the file is loaded by default To load more than just the first page the frames parameter must be specified with a page range To load the entire fil

Download Pdf Manuals

image

Related Search

Related Contents

衛危険  Excalibur EXFP300S Use and Care Manual  Protocolos de estudio de la enfermedad hemolítica  PD2250-font sub.p65  Fundex Games On the Bubble User's Manual  

Copyright © All rights reserved.
Failed to retrieve file