Thread: create a console based application in c language that can join and split bitmap image

  1. #1
    Registered User
    Join Date
    Jun 2013

    create a console based application in c language that can join and split bitmap image

    i have to create a console based application in c language that can join and split bitmap images.
    can anyone help me with the code.
    the requirements of the application are as follows :

    1. Split Image

    Enter number of parts:

    Enter source image path:

    Enter destination folder:

    2. Join Images (all images should be of same width and height)

    Enter image path:

    Join more Image (y/n):

    3. Exit

    Take care of following things:

    Application should show number of images processed while running.

    Acceptable Image format is BMP only.

    Application should give all the validations for correct image name, type, size, path, etc.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Long Beach, CA
    > can anyone help me with the code.
    We can help, but we can't write it for you. So you need to show us what code you have and tell us specifically what problems you are having. Then we can help you.

    To help you get started, read this: Bitmap - Wikipedia, the free encyclopedia. It helps to realize that a bitmap is just a 2-d array of pixels, along with some header info, so merging/splitting them is the same as you would do with any 2-d array.

    Lastly, it's important to approach this in an organized manner.

    1. Think about how you would do this "on paper", i.e. without a computer. Validate this by testing it out with some hand-made "bitmaps" (perhaps using graph paper, and small images, say 3x3 up to 10x10). You can't program the solution to a problem if you can't solve the problem in the first place.
    2. Break the problem up into reasonable smaller problems: process command line options; validate image names, types, sizes, paths, etc.; read the bitmap image into a 2-d array; write a 2-d array back to a bitmap file.
    3. Take careful note of each minute step you take along the way, those steps will form your algorithm.
    4. Turn those steps to pseudo code.
    5. Turn that pseudo code into real code, little by little.
    6. Remember to work in small chunks. Implement 5-10 lines of code, compile (make sure you get no warnings with warning levels set to max), and test. Never move on to the next section of code before you fix all the issues with what you currently have.

  3. #3
    Registered User
    Join Date
    May 2012
    Firstly you need to get rid of the file format issue.

    Write a function that takes the path to a bitmap file, and returns the raster data (and maybe palette). Write another one that takes the raster data (any maybe palette) and stored the result as a file. Test these, first by reading a file in and copying it, then by processing the data trivially.

    Now write code to split up and join images. I don't know what algorithm you will use, there are several sensible ways of splitting a N X M image three or more ways.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-13-2013, 08:31 PM
  2. Subject:How to create a C# console application?
    By Adock in forum C# Programming
    Replies: 5
    Last Post: 09-03-2008, 05:58 PM
  3. Replies: 12
    Last Post: 12-17-2007, 02:49 AM
  4. how to convert a bitmap image to a jpg image file using C++?
    By nomer in forum Windows Programming
    Replies: 4
    Last Post: 06-04-2006, 07:40 PM
  5. pthread create and join problems
    By rotis23 in forum C Programming
    Replies: 1
    Last Post: 10-11-2002, 08:41 AM

Tags for this Thread