Gif4J PRO for Java - Transform (resize, scale, rotate and flip) GIF Images using Java
Gif4J gif animation software logotype
Home Page for Gif4J Software java gif image processing products, solutions and services Products Page for java GIF image processing software Purchase java GIF image managing products Download Gif4J GIF image processing products Java imaging FAQs and Gif4J solutions support Contact Page Customer Area
Gif4J PRO java gif imaging class library logo

Transform a GIF Image

The GifTransformer class is the helper java class containing static methods to affine transform animated and non-animated GIF images represented by GifImage objects including resize, scale, rotate and flip gif image transform operations. The next methods to transform gif images are available (please consult the Gif4J PRO Java API for more info):

    public static final GifImage rotate(GifImage gifImage, double theta, boolean smooth);
    public static final GifImage rotate90Left(GifImage gifImage);
    public static final GifImage rotate90Right(GifImage gifImage);
    public static final GifImage rotate180(GifImage gifImage);
    public static final GifImage scale(GifImage gifImage,
                                                         double xscale, double yscale, boolean smooth);
    public static final GifImage resize(GifImage gifImage,
                                                           int width, int height, boolean smooth);
    public static final GifImage flipHorizontal(GifImage gifImage);
    public static final GifImage flipVertical(GifImage gifImage);


Note: smooth parameter (if presents) lets Java developers choose a gif image processing algorithm: if 'true' then the higher priority is given to a gif image smoothness than processing speed. But on the other hand it can bring about sizeable increase of the transformed GIF image size.

Gif4J PRO Java Example: Resize a GIF image using GifTransformer

        // ...

        // resize gif image to the width=100px
        // with maintaining the aspect ratio of the original gif image dimension
        GifImage resizedGifImage1 = GifTransformer.resize(gifImage, 100, -1false);
        // the same but smoothly
        GifImage resizedGifImage1_smooth = GifTransformer.resize(gifImage, 100, -1true);

        // resize gif image to the width=100px and height=60px
        GifImage resizedGifImage2 = GifTransformer.resize(gifImage, 10060false);
        // the same but smoothly
        GifImage resizedGifImage2_smooth = GifTransformer.resize(gifImage, 10060true);

        // ...

Resized GIF Images (the test image is out logo)
resized to width=100 gif image using Java smoothly resized to width=100 he gif image using Java
[100, -1] [100, -1, smoothly]
resized to width=100 and height=60 gif image using Java smoothly resized to width=100 and height=60 gif image using Java
[100, 60] [100, 60, smoothly]



Gif4J PRO Java Example: Scale a GIF image using GifTransformer

        // ...

        // scale gif image by factor 0.7 with maintaining
        // the aspect ratio of the original gif image dimension
        GifImage scaledGifImage1 = GifTransformer.scale(gifImage, 0.7, -1false);
        // the same but smoothly
        GifImage scaledGifImage1_smooth = GifTransformer.scale(gifImage, 0.7, -1true);

        // scale gif image by X-axis scale factor = 1.2 and Y-axis scale factor = 0.8
        GifImage scaledGifImage2 = GifTransformer.scale(gifImage, 1.20.8false);
        // the same but smoothly
        GifImage scaledGifImage2_smooth = GifTransformer.scale(gifImage, 1.20.8true);

        // ...

Scaled GIF Images (the test image is out logo)
scaled by factor 0.7 gif image using Java smoothly scaled by factor 0.7 gif image using Java
[0.7, -1] [0.7, -1, smoothly]
scaled by X factor 1.2 and Y factor 0.8 gif image using Java smoothly scaled by X factor 1.2 and Y factor 0.8 gif image using Java
[1.2, 0.8] [1.2, 0.8, smoothly]



Gif4J PRO Java Example: Rotate a GIF image using GifTransformer

       // ...

       // rotate gif image by 45 degrees (PI/4 radians)
       GifImage rotatedGifImage45 = GifTransformer.rotate(gifImage, Math.PI/4false);
       // the same but smoothly
       GifImage rotatedGifImage45_smooth = GifTransformer.rotate(gifImage, Math.PI/4,true);

       // rotate gif image by 90 degrees counter-clockwise
       GifImage rotatedGifImage90CCW = GifTransformer.rotate90Left(gifImage);

       // rotate gif image by 90 degrees clockwise
       GifImage rotatedGifImage90CW = GifTransformer.rotate90Right(gifImage);

       // rotate gif image by 180 degrees
       GifImage rotatedGifImage180 = GifTransformer.rotate180(gifImage);

       // ...

Rotated GIF Images (the test image is out logo)
rotated by 45 degrees image using Java
[45 degrees (PI/4 radians)]
smoothly rotated by 45 degrees image using Java
[45 degrees (PI/4 radians), smooth]
rotated by 90 CCW degrees image using Java rotated by 90 CW degrees image using Java
[90 degrees counter-clockwise] [90 degrees clockwise]
rotated by 180 CCW degrees image using Java
[180 degrees]



Gif4J PRO Java Example: Flip a GIF image using GifTransformer

        // ...

        // flip gif image vertically
        GifImage flipVerticalGifImage = GifTransformer.flipVertical(gifImage);

        // flip gif image horizontally (mirror gif image)
        GifImage flipHorizontalGifImage = GifTransformer.flipHorizontal(gifImage);

        // ...


Flip GIF Images (the test image is out logo)
flip gif image vertically using Java flip gif image horizontally (mirror) using Java
[vertically] [horizontally]


Gif4J java gif imaging lib (professional)
Gif4J PRO
Overview
 
Gif4J Java Color Quantizer
Overview
Quality Measurements & Benchmark Testing
Test Online
 
Gif4J PRO Tutorial
Loading GIF Images
Creating GIF Images
Creating GIF Frames
Transform GIF Images
Saving GIF Images
Watermarking
Morphing Filters
Text Rendering
 
Gif4J java gif imaging lib (light)
Gif4J LIGHT
Overview
 
Gif4J LIGHT Tutorial
Creating GIF Images
Creating GIF Frames
Saving GIF Images
 
Home |  Privacy Policy |  Legal Information 
© Gif4J Software 2004-2017