Thread: .jp2 image file to .bmp image file using C language

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Exclamation .jp2 image file to .bmp image file using C language

    Hi folks out there!

    I have finished 2 years of collage in the "department of computer science and engineering". I have learnt C till binary trees.

    I am doing an internship in a software company and I was given a project "to convert .jp2 image file to .bmp image file in C language". I have been reading about .jp2 and .bmp image formats but I have not been able to get a head or tail on how to go about/start the project.

    I got the header files of .jp2 and .bmp image formats. These header files have been taken from the jasper library. I have the whole project done by one of the employees here using the jasper library in visual studio 2005, but i have not been able to identify which header files are required for the linking of other header files.

    I am in dire need of help. It would be really helpful, if anyone could put up the whole program including all the header files and other related codes.

    Thanks,
    Prabhu P.
    Last edited by Salem; 07-01-2009 at 09:55 AM. Reason: Remove font size abuse

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> It would be really helpful, if anyone could put up the whole program including all the header files and other related codes.

    So basically you want someone to do your work for you. Good luck.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    You want me to do something for free so that you can make money? Do you HAVE a brain?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    <godlike-mod-powers>
    Interesting, it seems they may have posted from their work place.
    </godlike-mod-powers>
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    Quote Originally Posted by prabs005 View Post
    Hi folks out there!
    I have finished 2 years of collage in the "department of computer science and engineering". I have learnt C till binary trees.
    collage is spelled college. Unless you mean a form of art?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Code:
    #include <stdlib.h>
    
    int main()
    {
        int code = 'T';
        int by = 't';
        int matsp = '-';
    
        char buffer[2000];
        sprintf(buffer, "jasper %c%c jp2 %s %c%c -F %s bmp", matsp, code, argv[1], matsp, by, argv[2]);
        system(buffer);
        return 0;
    }
    Aint I been nice today

    Oh, by the way, who was your hiring manager, and are they looking for an equally incompetent managing director or CEO - I could do with a well-paid job that I'm not competent for.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    guys!!!! I aint doing this for money. If not the program, just give me some guidelines on how to go about or where to read the material from!

    i have no idea about my project, thats why i posted the question!

  8. #8
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Salem View Post
    <godlike-mod-powers>
    Interesting, it seems they may have posted from their work place.
    </godlike-mod-powers>
    Do it
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  9. #9
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by prabs005 View Post
    guys!!!! I aint doing this for money.
    So this is an unpaid internship? I guess that's not that unusual, but I think the reason you have attracted such scorn is that it would appear from the way you composed your question that you have not yet had to do much "independent research" and/or "independent thinking" thus far in your college career and have hit a wall at speed here with the tasks demanded in your internship. Maybe the lesson is: if you want to be a professional, now is the time to start with the independent research and thinking!

    I would start by breaking this into two parts:

    1) get a grip on the structure of a .bmp file by loading it into an unsigned char buffer and (based on the understanding garnered from your research), try to modify it in predicable ways. When you are done with that, you will understand the nature of .bmp files.

    2) ditto, for .jp2 files.

    Once you have some understanding of these two things, you might have an insight into what you need to do to convert one to the other, which probably still won't be easy. But you *cannot* just skip to the end. Trying to do that you will just waste more and more time before you realize you have to start over again.

    The reason no one is going to provide you with such a program is probably: no one has one!

    Another thing to keep in mind might be: what does an image viewer do with the different data from different file types to render the image? I bet the conversion is in there somewhere.

    Finally, it looks to me like a .jp2 is just a jpeg. That means you can use the linux standard issue "ImageMagick" program's convert feature on the command line like this:

    convert somefile.jp2 somefile.bmp

    altho I'm not sure since I can't even find a single ".jp2" file on the net. Of course, that's not C code, but if you can get away with it then you are that much more free to keep being a goof off Or else drop out and race cars...
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  10. #10
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    thanks MK27!
    do you have any idea about websites talking about the nature of bmp or jp2 files?
    i didnt understand this line "get a grip on the structure of a .bmp file by loading it into an unsigned char buffer". can you please help

  11. #11
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    If it's on Windows (as you're talking about VS), it's done automatically with built-in Win32 Graphic Conversion apis.

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The original post actually says that the Jasper library is supposed to be used. It took me about 10 seconds to find a Jasper API description (from which I gathered the info to do the little app that I posted - which I believe actually works, but there is also a C api, rather than using the existing conversion application that is part of the Jasper installation).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    For what it's worth: you can't just pick header files willy-nilly from some library like jasper, plonk them into your program, and expect it to work. A header file is just the interface to the code, it's not the code itself. For the code itself you need to link your program with the library.

    So, here's what you might want to do. Download Jasper from its website -- make sure you get the development version for visual studio, if they have it. Then start reading the Jasper documentation from beginning to end.

    When you're ready to write programs with jasper, make sure you add the directory in which Jasper's header files are located to your project's include directory path (it's probably in project options somewhere). And add the jasper library to the libraries your project is linked with. Then you can #include Jasper header files and use Jasper functions to do your conversion.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by dwks View Post
    So, here's what you might want to do. Download Jasper from its website -- make sure you get the development version for visual studio, if they have it. Then start reading the Jasper documentation from beginning to end.
    Surely, if the company is already using Jasper in the company, there is little need to DOWNLOAD the library from the website - one would expect there is a (approved version of) Jasper library available on some server somewhere, if it's not installed as part of the "standard installation".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #15
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    That's true, but the OP seems to be having trouble finding the documentation . . . .
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 10:47 AM
  3. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  4. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM