How to keep the picture movie after resizing it
Posted: 2009-11-06T01:41:56-07:00
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?
before resizing:
after resizing:
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
after resizing: