Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8747939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:26:27+00:00 2026-06-13T12:26:27+00:00

The task: I want to write a C++ header file that can load a

  • 0

The task:

I want to write a C++ header file that can load a given GIF file and turn it into RGBA array of pixels.

The problems:

I found trying to read the specification confusing because certain blocks (such as comments) can occur anywhere in the file. I also tried reading source code for other GIF loading files but I found these also highly confusing. I had attempted writing code for it, but after it went horribly wrong, I then deleted it and postponed trying to do it as it wasn’t required: it now is.

The restrictions:

I don’t wish to use an external library (suggesting boost is a bit of a cliche here) or pre-built code, as I want to understand what is going, but to write my own code notably for several reasons:

  1. So I can repair the code if it goes wrong.
  2. So I can expand the features and incorporate them with other pre-existing classes I have.
  3. To avoid licencing problems:
    • So I don’t get sued for misuse (I neither want to pay or be forced to make my code open-source).
    • So I can bundle the code with, or sell the program (this is unlikely but I’m covering bases here) without any copyright/copyleft issues.
    • So I can safely give the code to others and be able to tell them they don’t have to worry about a licence.
    • So I can offer the code to a library that lacks GIF loading so they can use it without worrying about licence issues.
  4. To keep the codebase small (compared to a library of other features).

I know that’s quite a list and seems unnecessary but when I previously say on stack overflow ‘no libraries’ people assume it’s something optional that they can argue me into submission or force a library down my throat.

The questions:

What is the best way to both understand (I found the specification confusing remember) and implement GIF loading so it converts a GIF (which might be a singular image or a series of images) into an array of pixels? And how best to ignore ‘unnecessary’ data (at least in regards to the task at hand, so ignoring comments etc) when reading?

For convenience you can assume a pixel array class already exists.

Clear-cut code snippets with explanations would be appreciated on this one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:26:29+00:00Added an answer on June 13, 2026 at 12:26 pm

    Ok, since i can’t edit my comment anymore…. As Mat suggested, try to understand the spec. I recommend the site http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp#comment_extension_block since in my opinion it is a good source of information about the structure of the gif format, with much graphics and byte-code-examples. For example your question about the comments: When you find an byte-pair 21 FE in your datastream this is introducing a comment block. The following bytes indicate the ascii characters and at the end of the block you will find a 00.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the task I want to achieve is import XML file into SQL Server. Once
I want to write an ant macro that will call the fail task if
I want to write a little Linux Kernel Module that can show me the
I want to write a script that will stop a scheduled task on a
I want to write a simple task which will update and commit source code
I have a function that does a long task and I want to update
I want to start a calculation task that will last for a couple of
I'm given a task to write a user authentication and login system in java.
I want to use a Rake task to cache my sitemap so that requests
I want to call a rake task from a cron job that stores remote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.