This document is the starting point for learning about the Graphics Conversion service. The following topics are covered:
The Graphics Conversion service provides a server-side JAX-RS resource that supports scaling and conversions to and from many graphics formats. See the conversion chart for details.
From/To GIF JPEG PNG TIFF GFX GIF Yes Yes[1] No Yes[1] No No JPEG Yes[1] Yes No Yes No No --- --- --- --- --- --- PNG Yes[1] Yes No Yes No No SVG No Yes Yes Yes Yes Yes[2] TIFF --- --- --- --- --- --- [1] Supported only with Java SDK Version 6.0 or higher.
[2] There are currently limitations in the scope of SVG to GFX function. See the Limitations section.
A sample client application, provided via the Mobile Showcase sample on WebSphere Application Server, illustrates a simple Ajax invocation of the Graphics Conversion service. The client allows users to specify an URL for the graphic file that needs conversion, the image format to convert the existing image into, and an optional maximum width and height for the generated image (if scaling is requested). The service returns either a URL to the converted file, or the binary image, to use in whatever format is most convenient for the client application. Since the options are URL query parameters, users can also build the URL with necessary parameters, and their browser will display the converted image.
Product prerequisite | Version |
---|---|
Java Technology Edition | 5.0 and later |
|
WebSphere Application Server Version 6.1.0.x and later WebSphere Application Server Community Edition Version 2.X. |
Web browser | Any modern web browser, such as: Internet Explorer 7 and later Mozilla Firefox 3.x and later Google Chrome Safari Opera |
To use the Graphics Conversion service, deploy the service .ear file to an application server. Read about Installing the Graphics Conversion service.
After the service is deployed, you can use the client demo provided. The demo is available at:
http://<server>:<port>/appsvcs-graphics/
Try different values in the various input fields to see the converted images.
To directly generate dynamic image conversions in your browser, you can also enter a URL with the parameters that you specify; for example,:
http://<server>:<port>/appsvcs-graphics/rest/graphics/convert/binaryResponse?sourceUrl=<graphic_file_url>&desiredFormat=<new_format>&maxWidth=<optional_width>&maxHeight=<optional_height>
Note working files and converted files returned via URL-reference are stored in a temporary directory location which is specified by the resultsTmpDir configuration parameter that is declared in an initialization parmater of the web.xml file. The following portion of web.xml file demonstrates its use:
... <init-param> <!-- Set the following property to the full path where you want newly scaled and converted images to be saved. --> <!-- For example, on Linux/Unix: /tmp --> <!-- For example, on Windows: c:\temp --> <!-- When no value is specified, the default is the "javax.servlet.context.tempdir" ServletContext attribute set by the web container. --> <!-- When the special string java.io.tmpdir is specified, the service uses the Java system property with key "java.io.tmpdir" --> <param-name>com.ibm.ws.mobile.appsvcs.graphics.resultsTmpDir</param-name> <param-value>java.io.tmpdir</param-value> </init-param> ...
Refer to the following version-specific installation instructions:
This section describes the procedure for installing the Graphics Conversion service into Version 6.1.0.X and later of the IBM WebSphere Application Server. It is assumed that you are familiar with application installation and administration for the application server.
Locate the Graphics Conversion service enterprise archive (EAR) file that is provided with your product installation. You can find the EAR file in your installation tree where you installed the IBM WebSphere Application Server Feature Pack for Web 2.0 and Mobile. For example, if you installed the feature pack in the following location:
Platform Location Linux and UNIX: /opt/WebSphere/AppServer z/OS mount point: <install_root> Windows: c:\WebSphere\AppServer
Then you can find the EAR file at:
Platform Location Linux and UNIX: /opt/WebSphere/AppServer/web2mobilefep_1.1/installableApps/application_services/graphics/appsvcs-graphics.ear z/OS: <install_root>/web2mobilefep_1.1/installableApps/application_services/graphics/appsvcs-graphics.ear Windows: c:\WebSphere\AppServer\web2mobilefep_1.1\installableApps\application_services\graphics\appsvcs-graphics.ear
- Log into the administrative console for the application server.
- Navigate to Applications > New Application. (Note: In WebSphere Application Server Version 6.1, select Install New Application)
- Select New Enterprise Application. (Note: In WebSphere Application Server Version 6.1, skip this step)
- Browse your file system, and select the appsvcs-graphics.ear file that you located earlier. Click Next.
- Click Next to prepare for the application installation. (Note: In WebSphere Application Server Version 6.1, skip this step)
- Click Next to accept the default installation options.
- Click Next to accept the default options for map modules to servers.
- Click Next to accept the default options for Metadata for modules. (Note: In WebSphere Application Server Versions 6.1 and 7, skip this step)
- Click Next to accept the default options for map virtual hosts for web modules.
- Review the summary of the installation options.
- Click Finish.
- Click Save to the master configuration.
- Navigate to Applications > Application Types > WebSphere Enterprise Applications. (Note: In WebSphere Application Server Version 6.1, Navigate to Applications > Enterprise Applications)
- Select the IBM WebSphere Application Server - Graphics Conversion service, and click Start.
This section describes the procedure for installing the Graphics Conversion service into Version 2.X of the IBM WebSphere Application Server Community Edition. It is assumed that you are familiar with application installation and administration for the application server.
Locate the Graphics Conversion service enterprise archive (EAR) file that is provided with your product installation. You can find the EAR file in your installation tree where you installed the IBM WebSphere Application Server Feature Pack for Web 2.0 and Mobile. For example, if you installed the feature pack in the following location:
Platform Location Linux and UNIX: /opt/WebSphere/AppServerCommunityEdition Windows: c:\WebSphere\AppServerCommunityEdition
Then, you can find the EAR and library files at:
Platform Location Linux and UNIX: /opt/WebSphere/AppServerCommunityEdition/web2mobilefep_1.1/AppServices/installableApps/graphics/appsvcs-graphics.ear Windows: c:\WebSphere\AppServerCommunityEdition\web2mobilefep_1.1\AppServices\installableApps\graphics\appsvcs-graphics.ear
Log into the administrative console for the application server.
- Click Applications > Deployer in the left menu. (Note: In WebSphere Application Server Community Edition Version 2.0, click Applications > Deploy New)
- In the Archive field, browse your file system, and select the appsvcs-graphics.ear file that you located earlier. Leave the Plan field empty and the default options selected. Then click Install.
The application starts automatically, and installation is complete.