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

  • Home
  • SEARCH
  • 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 8499631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:43:11+00:00 2026-06-11T00:43:11+00:00

How to Check if an image is valid For example, when I cached an

  • 0

How to Check if an image is valid

For example, when I cached an image which was downloaded only half and failed, and this image is invalid, then I want to know it’s an invalid image and download again.
(When I use the broken image, Xcode console logs an error:
ImageIO: PNG IDAT: CRC error )

So I want find a mechanism to check image’s validation
for different kinds of JPEG,PNG,etc

anybody has some clues?

  • 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-11T00:43:12+00:00Added an answer on June 11, 2026 at 12:43 am

    I would start by checking for valid header.
    Secondly the footer. Usually the last 8 bytes uint values in order are
    ‘73,69,78,68,174,66,96,130’.
    This converted into a Int64 equals 5279712195050102914

    This should do for a png 🙂

    if (memcmp(img_bytes, “\211PNG”, 4) != 0||OSReadBigInt64(img_bytes,(length – 8))!=5279712195050102914)

    {

      //Bad Data! Free your data and return or something
    

    }

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

Sidebar

Related Questions

If you don't know what I mean, check this image out: Multiple images I
i m making APP which do image proceesing using java SE.i want to check
I want to check a file has a valid IMAGE_DOS_SIGNATURE (MZ) function isMZ(FileName :
I have created a DeclarativeServiceLibrary using VS2010 beta 2, Please check this image of
I would like to check what colors is present in a image. This will
How can I check if a string is a valid URL? For example: http://hello.it
I have to download an image from a url and then show the downloaded
How can I check if a C# System.Drawing.Bitmap image is valid before adding it
I want read-only check boxes to be greyed out, but display their checked/unchecked status
My question is how do you check the image's resource? In my onClick method

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.