Getting started with the Graphics Conversion service

This document is the starting point for learning about the Graphics Conversion service. The following topics are covered:

Overview

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 PDF PNG TIFF GFX
GIF Yes Yes[1] No Yes[1] No No
JPEG Yes[1] Yes No Yes No No
PDF --- --- --- --- --- ---
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.

Note:
  • The Graphics Conversion sample application is only to illustrate one possible use of the Graphics Conversion service, and to illustrate how one would use AJAX invocations to make the REST request.
  • Because of limitations existing in certain browsers with respect to rendering SVG content within img and iframe html tags, workarounds are sometimes used which involve rendering non-SVG image when SVG image is selected. However, this is simply for selection display purposes and is so noted within the html document. However, when the actual AJAX request is sent to the service the actual SVG image is always sent in for conversion. In the results view, you will always see the actual converted image, which can be saved if necessary.

Prerequisites:

Product prerequisite Version
Java Technology Edition 5.0 and later
Java Platform, Enterprise Edition 5
application server 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

Limitations

Security considerations

Using the Graphics Conversion service

  1. To use the Graphics Conversion service, deploy the service .ear file to an application server. Read about Installing the Graphics Conversion service.

  2. After the service is deployed, you can use the client demo provided. The demo is available at:

    http://<server>:<port>/appsvcs-graphics/
    
  3. Try different values in the various input fields to see the converted images.

  4. 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>
    

Installing the Graphics Conversion service

Refer to the following version-specific installation instructions:

WebSphere Application Server 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.

Before you begin

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

Installing the Graphics Conversion service using the administrative console

  1. Log into the administrative console for the application server.
  2. Navigate to Applications > New Application. (Note: In WebSphere Application Server Version 6.1, select Install New Application)
  3. Select New Enterprise Application. (Note: In WebSphere Application Server Version 6.1, skip this step)
  4. Browse your file system, and select the appsvcs-graphics.ear file that you located earlier. Click Next.
  5. Click Next to prepare for the application installation. (Note: In WebSphere Application Server Version 6.1, skip this step)
  6. Click Next to accept the default installation options.
  7. Click Next to accept the default options for map modules to servers.
  8. Click Next to accept the default options for Metadata for modules. (Note: In WebSphere Application Server Versions 6.1 and 7, skip this step)
  9. Click Next to accept the default options for map virtual hosts for web modules.
  10. Review the summary of the installation options.
  11. Click Finish.
  12. Click Save to the master configuration.
  13. Navigate to Applications > Application Types > WebSphere Enterprise Applications. (Note: In WebSphere Application Server Version 6.1, Navigate to Applications > Enterprise Applications)
  14. Select the IBM WebSphere Application Server - Graphics Conversion service, and click Start.

WebSphere Application Server Community Edition Version 2.X installation instructions

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.

Before you begin

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

Installation through the administrative console

Log into the administrative console for the application server.

  1. Click Applications > Deployer in the left menu. (Note: In WebSphere Application Server Community Edition Version 2.0, click Applications > Deploy New)
  2. 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.