ASP to generate GIF animation files tutorial

Source: Internet
Author: User
Tags add chr header transparent color
ASP no component adds multiple static GIF pictures to create a new GIF animation. The programming steps are as follows:

1, import a, B, c three static GIF pictures (read separately with ADODB.stream) file, first one of the file head + color plate passed to gifheadinfo, after useful.

2, read the width and height of three pictures respectively, pass the biggest one width value to gifwidth, likewise, pass the maximum one height to gifheight. With these two values, we also replace the height and width in the gifheadinfo with the Gifwidth,gifheight, and the new file header is generated.

3. Add a mark to the GIF file header to identify an animated GIF picture. Identify whether it is an animation, and check to see if the file contains Chr (0x21). chr (0xff). chr (0x0b). ' NETSCAPE2.0 ' Chr (0x21). Chr (0xff) is the extension function segment's header ' NETSCAPE2.0 ' in GIF pictures is the program name that the extension function executes. This also controls the number of times the GIF animation is played. If the value is 0, it is played for an infinite number of times, which we just have to be 0 OK.

4, this step is simple, is to add three images of GIF image data, each image data at the beginning of the picture information header, specify the width and height of the picture, as well as offset. OK, if we want to have all three images centered (that is, horizontally centered, vertically centered), we've set the width and height of the GIF animation to the maximum, so the width and height of the three graphs is only equal to or less than, but not more than, we look at the width and height of the three graphs respectively, If the width (high) is equal to the skip, the x= (gifwidth-thisgifwidth)/2 is the horizontal offset, and Y (vertical offset) is the same.

5, after the 4th step, we have achieved the three images are centered, as for the playback order, is that you placed three pictures of the order. ^_^...

6, remember in each picture (now should be said to be the frame of this GIF animation) also add a delay time, set this frame background color, transparent color, and so on. In fact, in a GIF animation tool is called "GIF Movie Gear" Frame properties can be very detailed to see what the GIF animation and its frame properties need to be set, and then for a GIF animation to slowly analyze to see which attribute in which location.

7, OK, our GIF animation production completed.



Related Article

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.