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:
![Image](http://b28.photo.store.qq.com/http_imgload.cgi?/rurl4_b=9d2b49fce8c03a652e8196e117ab782ced47bb22824318559e955e2634544273c9a8aed677de88bae4afdcbc4110a27a46e249555e28d2ff1e8e7fa95f4fa4ade398c25b073dbd06b8af6e48c2cf4fd6897760f2&a=28&b=28)
after resizing:
![Image](http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=9d2b49fce8c03a652e8196e117ab782c707eb000fd5e25477236cc66003f6891ec98712f8ef55e75b7117e750d1194c4b63ab59e1bea44b9e7accb293f90cef502578e1fc01ee008ef6e2b692eb66e327bce7fde&a=25&b=25)
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: