CN1960490B - Method for converting GIF file to SWF file - Google Patents

Method for converting GIF file to SWF file Download PDF

Info

Publication number
CN1960490B
CN1960490B CN 200510115494 CN200510115494A CN1960490B CN 1960490 B CN1960490 B CN 1960490B CN 200510115494 CN200510115494 CN 200510115494 CN 200510115494 A CN200510115494 A CN 200510115494A CN 1960490 B CN1960490 B CN 1960490B
Authority
CN
China
Prior art keywords
frame
file
swf
gif
content
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN 200510115494
Other languages
Chinese (zh)
Other versions
CN1960490A (en
Inventor
王麒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Tencent Computer Systems Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN 200510115494 priority Critical patent/CN1960490B/en
Publication of CN1960490A publication Critical patent/CN1960490A/en
Application granted granted Critical
Publication of CN1960490B publication Critical patent/CN1960490B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The method comprises: after displaying the current frame of GIF file, deciding how to process the current frame; if reserving the content of the current frame, the copying the current frame of GIF file into the SWF file, and identifying the current frame as reserving the content of the frame in the SWF file; if deleting contents of all frames before the next frame of the current frame, copying the current frame of GIF file into the SWF file, and identifying the current frame in SWF file as deleting all contents of all frames before the next frame of the current frame when playing the next frame of the current frame.

Description

A kind of method that gif file is converted to the SWF file
Technical field
The present invention relates to the computer animation technology, relate in particular to a kind of method that gif file is converted to the SWF file.
Background technology
In the computer animation in early days, the mutual form of image (GIF, Graphics InterchangeFormat) file is main way of realization.Nowadays, along with the develop rapidly of internet, the Flash technology begins at leisure to substitute GIF, becomes to make the strong tool of webpage multimedia animation.Flash makes software by a multimedia animation that U.S. MACROMEDIE company releases.It is a kind of interactive animation design tool, music, sound effect, animation can be merged easily with it, produces high-quality animation effect.
Utilize the Flash technology can produce the animation of a kind of suffix SWF (Shockwave Format) by name, the animated image of this form can show abundant multimedia form by enough smaller volumes.Aspect the transmission of image, needn't wait until that file is all downloaded just can watch, but can watch while downloading, therefore be particularly suitable for Network Transmission, particularly under the not good situation of transmission rate, also can obtain effect preferably.The fact has also proved this point, and nowadays SWF has been widely used in the Web webpage and has carried out multimedia presentation and interactivity design.In addition, the SWF animation is based on that vectoring technology makes, and therefore no matter picture is amplified and what dwindle doubly, therefore picture can not have any infringement, and has saved the size of animation file yet, improves the speed of Network Transmission under network bandwidth condition of limited.In a word, the works of SWF form have been subjected to more and more Web page makers' favor with the image quality of its high definition and small and exquisite volume, also more and more become the main flow that web animation and Web page picture design and produce, and have become the de facto standard of online animation.
In view of the situation, usually need gif file with early stage cartoon making to be converted to SWF file under the Flash technology.Form though GIF animation and SWF animation all are the frames by a plurality of different contents of continuous broadcast, it is different that their play mechanism.
Gif file has shown after the present frame when being about to show next frame, current frame image is had two kinds of processing methods when playing: first kind is to keep current frame image, a frame that is about to show directly is superimposed upon the upper strata of present frame; Second kind is the image of removing all frames of front, recovers background colour, and a frame that is about to show is superimposed upon on the background colour.Can mix in a gif file and use these two kinds of processing methods, it can identify by the DisposeMethod value that each frame all has, and promptly the DisposeMethod of present frame is 1 o'clock, adopts first method to handle current frame image; Non-1 o'clock of the DisposeMethod of present frame adopts second method to handle current frame image.
Yet the SWF file is different.In the SWF file, there is a display list, the content of all frames all is kept in this display list, and when the Flash player was carried out the order of display frame, the SWF file took out whole display list, show present frame, and directly it is superimposed upon the upper strata of present frame when showing next frame.This is similar to the first kind processing method of gif file to present frame.
At present, the main method that converts gif file to the SWF file is that the message bit pattern with each frame in the gif file copies in the corresponding frame of SWF file display list simply, SWF file after the conversion is play each frame according to the broadcast mechanism of self when playing, like this, if there is piclear in the former gif file with previous frame, recover background colour, then next frame is superimposed upon the situation on the background colour, then in the playing process of SWF file, can't embody.Therefore, this conversion method is not considered different to level covering relation processing method between frame and the frame of gif file and SWF file, make conversion back SWF file can not embody the level covering relation between the frame and frame in the gif file fully, therefore, the image display effect of the two is inconsistent, and the display effect of image is bad after can causing changing.
Summary of the invention
In view of this, the present invention proposes a kind of gif file to be converted to the method for SWF file, and this method embodies the level covering relation between the frame and frame in the former gif file in can the SWF file after conversion fully, thereby makes the image display effect after the conversion better.
To achieve these goals, the invention provides and a kind of gif file is converted to the method for SWF file, this method specifically comprises the steps:
A1. corresponding to the frame of gif file, create the display list of SWF file, wherein display list comprises a plurality of frames, and each frame is corresponding to each frame of gif file;
A. judge gif file when playing, shown present frame after to the processing mode of this frame, if keep the content of this frame, execution in step B; If remove the content of the former frame that comprises this frame, then execution in step C;
B. with the content replication of gif file present frame in the SWF file, and in the display list of SWF file, this frame identification is kept this content frame when playing the next frame of this frame, simultaneously with the next frame of gif file as present frame, return execution in step A;
C. with the content replication of gif file present frame in the SWF file, and in the display list of SWF file, this frame identification removed when playing the next frame of this frame comprise this frame before the content of frame, simultaneously with the next frame of gif file as present frame, return execution in step A.
After described step C, be about to gif file and be converted to after the SWF file, further comprise:
Take out the display list of conversion back SWF file;
Play each two field picture of SWF file successively, judge the sign of present frame in the display list, if the sign of present frame is to keep this content frame, then the next frame with present frame is superimposed upon on the present frame, returns and carries out this step; If the sign of present frame is to remove the content of the former frame that comprises this frame, then remove all the elements of the former frame that comprises present frame, return and carry out this step.
Above-described next frame with present frame is superimposed upon on this frame, comprising: create a new layer for next frame, be positioned on the place layer of present frame, will be received within the next frame on this new layer.
In addition, judge described in the steps A gif file when playing, shown present frame after to the processing mode of this frame, comprise: whether the DisposeMethod value of judging the gif file present frame is predefined value, wherein, described predefined value is the value that keeps this content frame the expression gif file has shown present frame when playing after.
Among described step B and the step C, the gif file present frame is copied in the SWF file, comprising: with the content replication of gif file present frame in the corresponding frame of SWF file display list.
In addition, among the described step C, in the SWF file, this frame identification removed when playing next frame comprise in the SWF file this frame before the content of frame, comprising: with this frame identification is predefined value.
Can see from above technical scheme, a kind of method that gif file is converted to the SWF file provided by the invention, the content replication of gif file can be made two kinds of image coverage modes that embody former gif file in the SWF file after the conversion time the SWF file, thereby make the image display effect of conversion back SWF file consistent, avoided the bad problem of SWF file display effect with the image display effect of former gif file.
Description of drawings
Fig. 1 is that two kinds of image level covering relations with gif file are transformed into the operational flowchart in the SWF file;
Fig. 2 is the playing flow figure of conversion back SWF file.
Embodiment
The present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
Because gif file has two kinds of different processing methods to present frame when playing, and the SWF file has only a kind of processing mode to current display list when playing, so the simple copy by prior art can make conversion back SWF file can not embody level covering relation between gif file frame and the frame fully, to this, the present invention realizes changing the image covering relation that back SWF file embodies former gif file fully by the display list of SWF file is made amendment.
Because gif file can identify different processing methods by the DisposeMethod value, so can carry out different conversions at different DisposeMethod values respectively.Corresponding to gif file to be converted, create the display list of SWF file, this display list comprises a plurality of frames, corresponds respectively to the frame of gif file, it shows conversion back each frame content displayed of SWF file.When the value of the DisposeMethod of a certain frame in the gif file is 1, in transfer process, except the content with this frame of gif file directly copies to the corresponding frame of SWF file display list, also need make a sign at this frame place of SWF file display list, for example identifying this frame is 1, need to keep for this frame when playing the SWF file to be illustrated in, like this when playing the SWF file, player runs into the content that this sign just keeps display list, for the next frame of this frame is created a new layer, the number of plies of new layer is set to current all numbers of plies and adds one again, can guarantee that so initiate layer covers the content with anterior layer, the content of next frame is placed on this new layer play then.For example, when the value of the DisposeMethod of gif file front cross frame all is 1, when then converting the SWF file to, this two frame of gif file is copied to respectively in the corresponding frame of SWF file display list, and this two frame all is designated 1, when playing SWF file first frame, be that first frame is created a layer, be ground floor, be received within this layer in first frame that will duplicate from gif file and show, when playing second frame, be similarly second frame and create one new layer, be the second layer, this layer be positioned at ground floor above, will be placed on the second layer from second content frame that gif file duplicates then and show, so, the content of second frame just be superimposed upon first content frame above, so like this SWF file after the conversion has just shown gif file next frame is added to situation on the present frame when playing.
And when the value of the DisposeMethod in a certain frame in the gif file be non-1 the time, in transfer process, similarly, except the content with this frame of gif file directly copies to the corresponding frame of SWF file display list, still need this frame of SWF file display list is done a sign, for example identifying this frame is 0, display list need be emptied when playing to be illustrated in, like this, when playing the SWF file, player runs into sign 0 o'clock, just removes the content of all frames in the display list, creates a new layer then again, be received within this new layer in the next frame with this frame and go up demonstration, have only the content of current this one deck this moment in the display list, and player only shows the content of this one deck, then the SWF file after the conversion just shown gif file remove before the content of frame next frame is superimposed upon situation on the background colour.
Comprehensively above-mentioned, the concrete switch process that gif file is converted to the SWF file is as follows:
Step 101: corresponding to the frame of gif file, create the display list of SWF file, wherein display list comprises a plurality of frames, and each frame is corresponding to each frame of gif file;
Step 102: whether the value of judging the DisposeMethod of gif file present frame is 1, if, execution in step 103; Otherwise, execution in step 104;
The value of step 103:DisposeMethod be 1 explanation when after playing present frame, being about to show next frame gif file keep current frame image, next frame is superimposed upon on the present frame, at this moment, with the content replication of gif file present frame in the corresponding frame of SWF file display list, and be 1 with this frame identification in the display list, keep this content frame when being illustrated in the next frame of playing this frame of SWF file, simultaneously with the next frame of gif file as present frame, return execution in step 102;
Gif file was removed the content of all frames of front when non-1 explanation of the value of step 104:DisposeMethod was about to show next frame after playing present frame, recover background colour, next frame is superimposed upon on the background colour, at this moment, with the content replication of gif file present frame in the corresponding frame of SWF file display list, and be 0 with this frame identification in the display list, remove the content of the former frame that comprises this frame when being illustrated in the next frame of playing this frame of SWF file, simultaneously with the next frame of gif file as present frame, return execution in step 102.
According to top step, just can realize that conversion back SWF file embodies two kinds of image level covering relations of former gif file respectively, thereby make conversion back SWF file display effect better by modification to SWF file display list.After the conversion, the broadcast step of SWF file is as follows:
Step 201: the display list that takes out conversion back SWF file;
Step 202: the image of playing SWF file display list present frame;
Step 203: the sign of judging the display list present frame is 1 or 0, just the level covering relation of display list next frame and present frame judged, if be 1, and execution in step 204; Otherwise, execution in step 205;
Step 204: present frame be designated 1, explanation need be superimposed upon next frame the upper strata of present frame, institute thinks that next frame creates a new layer, the number of plies is that current all numbers of plies add one again, will be received within the next frame on this new layer, then with this frame as present frame, return execution in step 202;
Step 205: present frame be designated 0, explanation need be superimposed upon next frame on the background colour, so the content of all layers emptied at first in the past, create a new layer for next frame then, be made as ground floor, to be received within the next frame on the ground floor, then with this frame as present frame, return execution in step 202.
Can see from the above, gif file is being converted in the process of SWF file according to technology provided by the present invention, because the display list of SWF file is revised, so when playing the SWF file, can embody the image level covering relation of former gif file fully, make conversion front and back gif file consistent with the image display effect of SWF file.
Among the above embodiment, at the DisposeMethod of gif file present frame is 1 o'clock, with the corresponding frame identification of SWF file display list is 1, and at DisposeMethod non-1 o'clock, be 0 with the corresponding frame identification of SWF file display list, in fact, in actual applications, can carry out other sign to the corresponding frame of SWF file at the different value of DisposeMethod, as long as when playing, the SWF file player can be discerned them and take different player methods to get final product at them.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (6)

1. one kind is converted to the method for SWF file with gif file, it is characterized in that this method comprises the steps:
A1. corresponding to the frame of gif file, create the display list of SWF file, wherein display list comprises a plurality of frames, and each frame is corresponding to each frame of gif file;
A. judge gif file when playing, shown present frame after to the processing mode of this frame, if keep the content of this frame, execution in step B; If remove the content of the former frame that comprises this frame, then execution in step C;
B. with the content replication of gif file present frame in the SWF file, and in the display list of SWF file, this frame identification is kept this content frame when playing the next frame of this frame, simultaneously with the next frame of gif file as present frame, return execution in step A;
C. with the content replication of gif file present frame in the SWF file, and in the display list of SWF file, this frame identification removed when playing the next frame of this frame comprise this frame before the content of frame, simultaneously with the next frame of gif file as present frame, return execution in step A.
2. method according to claim 1 is characterized in that, after described step C, gif file is converted to after the SWF file, further comprises:
Take out the display list of conversion back SWF file;
Play each two field picture of SWF file successively, judge the sign of present frame in the display list, if the sign of present frame is to keep this content frame, then the next frame with present frame is superimposed upon on the present frame, returns and carries out this step; If the sign of present frame is to remove the content of the former frame that comprises this frame, then remove all the elements of the former frame that comprises present frame, return and carry out this step.
3. method according to claim 2 is characterized in that, the next frame of present frame is superimposed upon on this frame, comprising:
Create a new layer for next frame, be positioned on the place layer of present frame, will be received within the next frame on this new layer.
4. method according to claim 1 is characterized in that, to the processing mode of this frame, comprising the gif file of judgement described in the steps A has shown present frame when playing after:
Whether the DisposeMethod value of judging the gif file present frame is predefined value, and wherein, described predefined value is the value that keeps this content frame the expression gif file has shown present frame when playing after.
5. method according to claim 1 is characterized in that, among described step B and the step C, the gif file present frame is copied in the SWF file, comprising:
With the content replication of gif file present frame in the corresponding frame of SWF file display list.
6. method according to claim 1 is characterized in that, among the described step C, in the SWF file, this frame identification removed when playing next frame comprise in the SWF file this frame before the content of frame, comprising:
With this frame identification is predefined value.
CN 200510115494 2005-11-04 2005-11-04 Method for converting GIF file to SWF file Active CN1960490B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200510115494 CN1960490B (en) 2005-11-04 2005-11-04 Method for converting GIF file to SWF file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200510115494 CN1960490B (en) 2005-11-04 2005-11-04 Method for converting GIF file to SWF file

Publications (2)

Publication Number Publication Date
CN1960490A CN1960490A (en) 2007-05-09
CN1960490B true CN1960490B (en) 2010-08-18

Family

ID=38071949

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200510115494 Active CN1960490B (en) 2005-11-04 2005-11-04 Method for converting GIF file to SWF file

Country Status (1)

Country Link
CN (1) CN1960490B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1057121A (en) * 1990-06-04 1991-12-18 国际商业机器公司 Bi-directional graphics attribute conversion profile
GB2246933A (en) * 1990-06-13 1992-02-12 Rank Cintel Ltd Production of multi-layered video composite
CN1174645A (en) * 1994-12-06 1998-02-25 Cfb(新图象设计中心)有限公司 Picture transfer process and device
CN1414475A (en) * 2001-10-25 2003-04-30 北京联合创新科技有限公司 Method of converting Swf file format works as video frequency works
US6714202B2 (en) * 1999-12-02 2004-03-30 Canon Kabushiki Kaisha Method for encoding animation in an image file

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1057121A (en) * 1990-06-04 1991-12-18 国际商业机器公司 Bi-directional graphics attribute conversion profile
GB2246933A (en) * 1990-06-13 1992-02-12 Rank Cintel Ltd Production of multi-layered video composite
CN1174645A (en) * 1994-12-06 1998-02-25 Cfb(新图象设计中心)有限公司 Picture transfer process and device
US6714202B2 (en) * 1999-12-02 2004-03-30 Canon Kabushiki Kaisha Method for encoding animation in an image file
CN1414475A (en) * 2001-10-25 2003-04-30 北京联合创新科技有限公司 Method of converting Swf file format works as video frequency works

Also Published As

Publication number Publication date
CN1960490A (en) 2007-05-09

Similar Documents

Publication Publication Date Title
US20200289929A1 (en) System and method for capturing and sharing console gaming data
TWI538721B (en) System and method for capturing and sharing console gaming data
Jenkins Pop cosmopolitanism
Iwabuchi Contra-flows or the cultural logic of uneven globalization?
Dudrah Vilayati Bollywood: popular Hindi cinema-going and diasporic South Asian identity in Birmingham (UK)
TW201404443A (en) System and method for capturing and sharing console gaming data
CN101778282A (en) Method for concurrently playing different media files
CN101272262A (en) Method for inserting advertisement in game and its advertisement system
CN1960490B (en) Method for converting GIF file to SWF file
CN100452879C (en) Conversion method between files in different types
Michel LES ECRIVAINS NOIRS ET LE SURREALISME (FRENCH TEXT)
CN100469145C (en) Conversion method between files in different types
CN102724425B (en) A kind of method that teletext template is broadcasted
O'Barr Advertising in China
CN1561028A (en) Interdynamic web containing selection subject
CN1972366A (en) A method of making animation and method of color change based on the animation
Iwabuchi Symptomatic transformations: Japan in the media and cultural globalization
US11997326B2 (en) Method of streaming image content between server and electronic device, server for streaming image content, and electronic device for streaming image content
US20230171444A1 (en) Method of streaming image content between server and electronic device, server for streaming image content, and electronic device for streaming image content
Price Modernizing Metatheatre in the RSC’s A Mad World My Masters
Yujie A Study on the Application of Digital Multimedia Art in Mobile Game
Abdullah Product Placement in Mechamato Movie to Promote Places, Culture, and National Heritage
ROOS CHAPTER NINE LOST PERFORMANCE AND SHORT FILM: BEHRUPIYA ON THE STAGES OF GLOBAL CAPITALISM
Haag Tokyo Olympics of the Brush and Screen: Introduction to Literature Section
Nyong'o Subtleties of Resistance: Sweetness and Violence in Kara Walker's A Subtlety (2015)

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160106

Address after: The South Road in Guangdong province Shenzhen city Fiyta building 518057 floor 5-10 Nanshan District high tech Zone

Patentee after: Shenzhen Tencent Computer System Co., Ltd.

Address before: Shenzhen Futian District City, Guangdong province 518044 Zhenxing Road, SEG Science Park 2 East Room 403

Patentee before: Tencent Technology (Shenzhen) Co., Ltd.