Reputation: 3 Apprentice
- Active Members
- Active Posts:
- 68 (0.1 per day)
- 09-February 12
- Profile Views:
- Last Active:
- Mar 16 2013 08:47 AM
- Dream Kudos:
Posts I've Made
Posted 8 Nov 2012You could use the kernel library and convert your image to a 2dimensional array then do some matrix math on it.
Posted 3 Nov 2012Is there a way one could find the size of a header?
Posted 3 Nov 2012If you read the first two bytes of the file and they don't contain 0x4D and 0x42 you will know that this file is not a BMP file. However if the first two bytes are 0x4D and 0x42 you can not positively determine that this file is a BMP file. Even if you were to read the entire 54 byte header and the contents match the description of the header you can only assume that this is a BMP file but you still can't be 100% certain.
Ah, I see. How would you recommend finding the file type? I want to basically get down to raw data to perform operations on the picture itself, then once it is finished, save it again as the same file type.
Posted 3 Nov 2012
QuoteEssentially what I am attempting to do is extract the first two bytes in order to compare it to known signatures, such as PNG (89 50 4E 47 0D 0A 1A 0A). I will make an if else statement that looks for all known signatures of picture files, if it's not a picture file, exit the program.
How, exactly, would I go about doing that?
You would probably want to start by opening the file in binary mode. Second you also need to realize that just reading the first two bytes will not definitely tell you what kind of file you are dealing with. Also this: (89 50 4E 47 0D 0A 1A 0A) is 8 bytes not 2 bytes.
Let's say I am doing BMP then, and want to check if the file is definitely BMP
The signature seems to be 2 bytes. Can I read X amount of bytes from an offset in a file? On that note, could I cut off the header and save it, in order to add it back on later while I do raw manipulation of data?
Posted 9 Oct 2012take a look at strtok
If I were to loop through the whole array, doing strtok(array, "\n") each time, how would it break if the pattern was not found?
Excuse my inability to into C
- Member Title:
- D.I.C Head
- Age Unknown
- Birthday Unknown
Crowz hasn't added any friends yet.