Page 1 of 1

How to keep the picture movie after resizing it

Posted: 2009-11-06T01:41:56-07:00
by carol_sun
I want to resize a GIF image file use the code as follow. After resizing it, it's still a gif imgage file indeed, but it become static.
It seems only the first frame has been decoded . Is there something wrong in my code?

Code: Select all

            
            Magick::Blob blob(in_clone, insize);    //'in_clone' is original image file data
            Magick::Image img;
            img.read(blob);

            Magick::Geometry gm(smallWidth, smallHeight);   
            
            *orgHeight = img.rows();
            *orgWidth = img.columns();

           if ( img.rows() > smallHeight ||  img.columns() > smallWidth ) {
                img.scale(gm);
                img.modifyImage();
            }

            img.write(&blob, "GIF");

            *outsize = blob.length();
            *out = malloc(*outsize);
            memcpy(*out, blob.data(), blob.length());  // 'out' is new image file data after resizing
before resizing:
Image

after resizing:
Image

Re: How to keep the picture movie after resizing it

Posted: 2009-11-09T19:44:08-07:00
by anthony
NOTE this is not normally the forum I would write in, but I know about this.

While the command line will loop though the current image sequence resizing all images. Other API's do not. You will need to loop though reach image and resize it.

WARNING: GIF animation sequences need to be coalesced (layer method) into proper images without optimization before resizing. You can optimize (also a layer method) the animation after ward for frame and transparency optimizations again afterward.