Crowz's Profile User Rating: -----

Reputation: 3 Apprentice
Group:
Active Members
Active Posts:
68 (0.08 per day)
Joined:
09-February 12
Profile Views:
998
Last Active:
User is offline Mar 16 2013 08:47 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Crowz has not set their status

Posts I've Made

  1. In Topic: how to flip image vertically

    Posted 8 Nov 2012

    You could use the kernel library and convert your image to a 2dimensional array then do some matrix math on it.
    http://docs.oracle.c...age/Kernel.html
  2. In Topic: Finding the type of a file

    Posted 3 Nov 2012

    Is there a way one could find the size of a header?
  3. In Topic: Finding the type of a file

    Posted 3 Nov 2012

    View Postjimblumberg, on 03 November 2012 - 09:24 AM, said:

    If 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.

    Jim

    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.
  4. In Topic: Finding the type of a file

    Posted 3 Nov 2012

    View Postjimblumberg, on 03 November 2012 - 09:09 AM, said:

    Quote

    Essentially 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.

    Jim


    Let's say I am doing BMP then, and want to check if the file is definitely BMP
    http://www.fastgraph...der_format.html
    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?
  5. In Topic: Reading a char array one line at a time?

    Posted 9 Oct 2012

    View Postjjl, on 09 October 2012 - 08:40 PM, said:


    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

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Crowz hasn't added any friends yet.

Comments

Crowz has no profile comments yet. Why not say hello?