473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Save BMP images through C

i wanted to know if there is any way to save and open BMP images
through C.I wanteed to interact with some images through C.

Thanks for reading...
Niks

Feb 13 '06 #1
4 2963
In article <11**********************@g44g2000cwa.googlegroups .com>,
Niks <nb*****@gmail.com> wrote:
i wanted to know if there is any way to save and open BMP images
through C.I wanteed to interact with some images through C.


Standard C does not know anything about image formats.

You can get pre-written code, some of which might be fairly portable,
to parse and create BMP images. Here's one pointer to an article about
the internal format:

http://www.daubnet.com/formats/BMP.html
Note: if you are intending to -display- BMP images, then you are
inherently going to need to use facilities which are not part of C
(which does not know about graphics.) At that point, you might find
that all of the operating systems you are interested in having
your program run on, already provide BMP support, or that pre-written
BMP libraries are available for those OS's. Therefore unless you
are deliberately constructing a non-graphical graphics-file manipulation
program with wide portability as an important goal, then you might find
it more productive to use existing libraries rather than write your own.
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
Feb 13 '06 #2

"Walter Roberson" <ro******@ibd.nrc-cnrc.gc.ca> wrote
Therefore unless you
are deliberately constructing a non-graphical graphics-file manipulation
program with wide portability as an important goal, then you might find
it more productive to use existing libraries rather than write your own.

You imply that this is quite an unusual thing to want to do.
If fact it is not - it is very common to want some sort of graphical output
from a program that is inherently portable.
For instance the other day I was having a go at the travelling salesman
problem, so the obvious way to get a visual fix on the algorithm is to
output a graph of the cities and route travelled.
Feb 14 '06 #3
On 2006-02-13, Niks <nb*****@gmail.com> wrote:

i wanted to know if there is any way to save and open BMP images
through C.I wanteed to interact with some images through C.


You most certainly can manipulate any file you want with C. The language
provides facilities for opening, reading and wrtiting files. Try reading
about fopen, fread, fwrite and similar functions of the standard C
library, or fgets, fputs, fprintf, etc for text-based I/O.

Of course C works with simple byte streams, not knowing anything, nor
imposing any specific structure on files, so you will have to either
implement the parsing of the bmp format yourself (by using the file i/o
functions provided by C), or find some code that does this job for you,
and use it.

In an off-topic comment, if you just want to interface with other image
manipulation/loading programs and you don't necessarily need the "bmp"
format but any one will do, try reading about "ppm" or "portable pixmap"
which is an extremely simple format to read and write.

--
John Tsiombikas (Nuclear / Mindlapse)
nu*****@siggraph.org
http://nuclear.demoscene.gr/
Feb 16 '06 #4
Whoever dreamt up the .BMP file format was smoking some good herb. You
shall see.

Feb 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: lir | last post by:
Hi, I am trying to save a fram in a page using the execCommand("saveas") the html is save currectly but I can not save the gif on that page. How can I save the fram with the gif via...
1
by: mohan21_kumar | last post by:
Hi, How to Save images in ms word file when it is downloaded from asp.net application. I have used the following code to convert the html page into ms word file. but i'm not able to save the...
8
by: Mario Krsnic | last post by:
Hello and Merry Christmas! I flip in my card play some cards using the call "drawimage". These flipped cards are saved in temporary images on the server: temp1.jpg, temp2.jpg... Everything works...
3
by: =?Utf-8?B?Um9nZWxpbw==?= | last post by:
I'm having the wierdest problem. I'm trying to save images into a SQL 2005 database. the field is just called "IMAGES" and hte data type is "image". here is my code to save //following code...
3
by: jayasabari | last post by:
hai, i am saving the image in server by using response.saveas("path name") in .net. The image is saving but preview is not available. please can you give any suggestion. With Regards,...
4
by: Logician | last post by:
I am running on my PC Windows Forms to collect data from websites, including images. I hit a problem with images and javascript, and I would appreciate any help. The current code fails with a...
2
by: Simon Wigzell | last post by:
I have inherited a database driven website that comes with a table of image links. The images are scattered all of the internet and there are thousands of them. I would like to write an asp script...
4
by: yosh29rs | last post by:
I really have difficulty trying to save images to my vb program. Can anybody please help me how to save images in a simple vb program?
1
by: saadkhan | last post by:
please help me that how could i be able to save images in an array. I have made an array like: System.Drawing.Image arr = new System.Drawing.Image; But i have no idea how to save different images...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.