saving a .IMG file into .TIF format

This is a discussion on saving a .IMG file into .TIF format within the C Programming forums, part of the General Programming Boards category; hi all, I have got a bunch of files with .IMG extension and a c code which on execution asks ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    1

    saving a .IMG file into .TIF format

    hi all,
    I have got a bunch of files with .IMG extension and a c code which on execution asks for the input file name and then displays the image on the screen. but i want to save the image in a jpg or tif format. what addition i should make in the code for doing that ( i guess it has got to do something with file handling)

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by samik View Post
    hi all,
    I have got a bunch of files with .IMG extension and a c code which on execution asks for the input file name and then displays the image on the screen. but i want to save the image in a jpg or tif format. what addition i should make in the code for doing that ( i guess it has got to do something with file handling)
    Sure, in the sense that building a house has something to do with nails...

    The TIFF format, while not overly complicated, isn't exactly trivial either. And you can't even begin to solve this problem without understanding more about this "IMG" file format.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You are probably best off working of some existing library, since almost all variants of image format is fairly complex - both JPEG and TIFF are formats that require a fair bit of work to store the image itself. JPEG is probably a bit harder to implement than TIFF. But as I started out, there are good libraries about that do all the hard work for you, all you need to do is give it some basic settings (e.g. the name of a file to store the image in, number of bits per pixel, how many pixels (X, Y) and where the pixels themselves are stored in memory). Shouldn't take more than about half a day to a day to achieve that.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. Replies: 5
    Last Post: 06-07-2007, 01:41 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21