C # Image Processing: Obtain frames in animated GIF images

Source: Internet
Author: User
Using system. drawing; using system. drawing. drawing2d; using system. drawing. imaging; public class imagehelper {/// <summary> // obtain each frame in the image /// </Summary> /// <Param name = "ppath"> image path </ param> /// <Param name = "psavepath"> Save path </param> Public void getframes (string ppath, string psavedpath) {image GIF = image. fromfile (ppath); framedimension FD = new framedimension (GIF. framedimensionslist [0]); // get the number of frames (GIF images may contain multiple frames, and images of other formats are generally only one frame) int COUNT = GIF. getframecount (FD); // save each frame in JPEG format for (INT I = 0; I <count; I ++) {GIF. selectactiveframe (FD, I); GIF. save (psavedpath + "\ Frame _" + I + ". jpg ", imageformat. JPEG );}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.