matteobruni / GIF_decoder

GIF decoding and rendering with HTML5 canvas

Home Page:https://maz01001.github.io/GIF_decoder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GIF decoder

GIF decoding and rendering with HTML5 canvas

Type documentation

The GIF object constructed has the following attributes.

GIF attributes

Click to toggle table
AttributeJSDoc annotationDescription
widthnumberthe width of the image in pixels (logical screen size)
heightnumberthe height of the image in pixels (logical screen size)
totalTimenumberthe total duration of the gif in milliseconds (all delays added together) - will be Infinity if there is a frame with the user input delay flag set and no timeout
colorResnumberthe color depth/resolution in bits per color (in the original) [1-8 bits]
pixelAspectRationumberif non zero the pixel aspect ratio will be from 4:1 to 1:4 in 1/64th increments
sortFlagbooleanif the colors in the global color table are ordered after decreasing importance
globalColorTable[number,number,number][]the global color table for the GIF
backgroundImageImageDataan image filled with the background color (can be used as a background before the first frame) - if the global color table is not available this is transparent black
framesFrame[]each frame of the GIF (decoded into single images) - type information further below
comments[number,string][]comments in the file and on with frame they where found
applicationExtensionsApplicationExtension[]all application extensions found - type information further below

Frame attributes

Click to toggle table
AttributeJSDoc annotationDescription
leftnumberthe position of the left edge of this frame, in pixels, within the gif (from the left edge)
topnumberthe position of the top edge of this frame, in pixels, within the gif (from the top edge)
widthnumberthe width of this frame in pixels
heightnumberthe height of this frame in pixels
disposalMethodDisposalMethodthe disposal method for this frame - type information further below
imageImageDatathis frames image data
plainTextDataPlainTextData|nullthe text that will be displayed on screen with this frame (if not null) - type information further below
userInputDelayFlagbooleanif set waits for user input before rendering the next frame (timeout after delay if that is non-zero)
delayTimenumberthe delay of this frame in milliseconds
sortFlagbooleanif the colors in the local color table are ordered after decreasing importance
localColorTable[number,number,number][]the local color table for this frame
reservednumber_reserved for future use_ (from packed field in image descriptor block)
GCreservednumber_reserved for future use_ (from packed field in graphics control extension block)

DisposalMethod attributes (enum)

Click to toggle table
NameInternal value (number)DescriptionAction
Replace0unspecifiedreplaces entire frame
Combine1do not disposecombine with previous frame
RestoreBackground2restore to backgroundcombine with background (first frame)
RestorePrevious3restore to previousrestore to previous undisposed frame state then combine
UndefinedA4undefinedfallback to Replace
UndefinedB5undefinedfallback to Replace
UndefinedC6undefinedfallback to Replace
UndefinedD7undefinedfallback to Replace

PlainTextData attributes

Click to toggle table
AttributeJSDoc annotationDescription
leftnumberthe position of the left edge of text grid (in pixels) within the GIF (from the left edge)
topnumberthe position of the top edge of text grid (in pixels) within the GIF (from the top edge)
widthnumberthe width of the text grid (in pixels)
heightnumberthe height of the text grid (in pixels)
charWidthnumberthe width (in pixels) of each cell (character) in text grid
charHeightnumberthe height (in pixels) of each cell (character) in text grid
foregroundColornumberthe index into the global color table for the foreground color of the text
backgroundColornumberthe index into the global color table for the background color of the text
textstringthe text to render on screen

ApplicationExtension attributes

Click to toggle table
AttributeJSDoc annotationDescription
identifierstring8 character string identifying the application
authenticationCodestring3 bytes to authenticate the application identifier
dataUint8Arraythe (raw) data of this application extension

Available URL parameters

URL parameters can be in any order (starting with ? after the URL then parameters in format PARAMETER=VALUE with & between each parameter)

Click to toggle table
ParameterPossible valuesDescriptionDefault value
gifURLHTML image source (URL)
(encoded URI component)
the GIF to decode and renderthis GIF from Wikipedia
alertErrors0 or 1Errors while decoding will open an alert pop-up1
forceClearLastFrame0 or 1Forces to clear the screen after the last frame, regardless of what the GIF file says1

About

GIF decoding and rendering with HTML5 canvas

https://maz01001.github.io/GIF_decoder/

License:MIT License


Languages

Language:JavaScript 99.0%Language:HTML 1.0%