This discussion is archived
3 Replies Latest reply: Oct 15, 2013 8:08 AM by rp0428 RSS

Trying to get the Filetype of a file with a random extension.  i.e., image.1

KonradZuse Explorer
Currently Being Moderated

Hello all,

 

 

 

I am dealing with images with the .1 -.6 standard which is used by companies like Gladson imagery.  I am given these files and I need to find out there FileTypes, which I also have heard can be called "MIME" types?  If that is different I let me know please.

 

I tried to use the Files API Files (Java Platform SE 7 )

 

Specifically probeContentType, but I get "null" for the .1 images, while the .bmp image does give me "image/bmp" as the result.

 

I am thinking of reading the file into the program, then just outputting it into a file with a readable extension.

 

Or is there a better way to do this?

 

Thanks,

 

~KZ

  • 1. Re: Trying to get the Filetype of a file with a random extension.  i.e., image.1
    rp0428 Guru
    Currently Being Moderated
    I am dealing with images with the .1 -.6 standard which is used by companies like Gladson imagery.

    And how would anyone even know what you are talking about?

     

    If you want help it is YOUR responsibility to provide the information anyone would need to help you. No one is going to go searching the web to try to find out what a '.1 -.6 standard' might be, assuming there even is such a thing.

  • 2. Re: Trying to get the Filetype of a file with a random extension.  i.e., image.1
    KonradZuse Explorer
    Currently Being Moderated

    Maybe they would know by reading where I said "I'm trying to get the file type without knowing the file extension."

     

    Or maybe where I use probing to get the file extension.

     

     

     

     

     

    .1-.6 means nothing, it's a file extension given by Gladson.  Gladson > Our Services > Product Image Database but you seem to ignore this.

     

    What I need to know is how to read the contents of the graphics file, I could make my image image.tunafishsammich, but that doesn't mean I have to know what tunafishsammich is.

     

    Again, I said I will probably read the file, and just output it as a bmp myself.  Seems easier.

     

    Again, unless someone else has a better option.

     


    I don't know why a lot of the people on this forum feel the need to tell people their questions aren't good enough, when the question is pretty simple.  I've seen this a lot, and I've answered many questions like this, after others said the OP needed to "explain".  Just because you don't know part of the question, doesn't mean the question is invalid.  Especially when the part of the question, in this case the .1 fileExtention doesn't really have much to do with the question, which is why it was an example.

  • 3. Re: Trying to get the Filetype of a file with a random extension.  i.e., image.1
    rp0428 Guru
    Currently Being Moderated
    .1-.6 means nothing, it's a file extension given by Gladson.  Gladson > Our Services > Product Image Database but you seem to ignore this.

    You say it means 'nothing' but your original question says it is a standard:

    I am dealing with images with the .1 -.6 standard which is used by companies like Gladson imagery

    I've never heard of any such '.1 -.6 standard' and can't find ANY reference on the web to any such standard.

     

    So it is only appropriate to ask you what you are talking about. You didn't explain WHAT standard you are referring to, provide ANY information about that 'standard' or provide any link to documentation about that 'standard' so we can figure out what you are talking about.

    I don't know why a lot of the people on this forum feel the need to tell people their questions aren't good enough, when the question is pretty simple.

    They do that to let you know that you need to provide MORE information or a better explanation of what you are asking.

    Just because you don't know part of the question, doesn't mean the question is invalid.

    Reread my reply and you will see that it doesn't say the question is 'invalid'. It said

    If you want help it is YOUR responsibility to provide the information anyone would need to help you. No one is going to go searching the web to try to find out what a '.1 -.6 standard' might be, assuming there even is such a thing.

    You began your thread by referring to a 'standard' and I can find NO such standard anywhere. So there is no context for your question since it relates to a standard that doesn't appear to exist.

      Especially when the part of the question, in this case the .1 fileExtention doesn't really have much to do with the question, which is why it was an example.

    You are the one that first mentioned a 'standard'. If it doesn't 'have much to do with the question' then you are just confusing the issue by including it as a key part of your thread. If there IS such a standard then, being a standard, it would be documented and that documentation would likely explain the actual binary format of files that are created using that standard. That binary format would have information that could be used to identify the file type.

     

    For example a PDF file uses a 'standard' file format. The format is documented by Adobe and if you examine a file you might find the first line looks like this:

    %PDF-1.4

    That 'signature' helps to identify the file as using the PDF file format.

     

    But now you seem to be asking this totally different question:

    Given graphic files with meaningless names and extensions (and thus of unknown type) how does one determine the actual FileTypes (BMP, GIF, etc), which I also have heard can be called "MIME" types?

    Is that the question you are really asking?

     

    If it is then there IS NO generic way to identify an arbitrary file format since each 'standard' format is different and will have different possible 'signature' characteristics. You would have to have code to test for EVERY possible 'signature'.

     

    That is why if the standard you referenced actually existed it would help determine what the list of POSSIBLE file types might be. If you know that each file MUST BE a Gladson file type then the first step is to create a list of ALL possible file types that Gladson uses.

     

    Then you can locate the documentation for each of those file types (e.g. BMP, GIF, etc) to determine how to create a 'parser' to check for those 'signatures'.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points