473,385 Members | 1,267 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,385 software developers and data experts.

loading an image in a c program

I am looking for an include or header file to transfer an image(*.bmp)
in to my c program.is there any tool for this purpose?
Thank you.
Maryam
Nov 14 '05 #1
5 3036
Maryam wrote:
I am looking for an include or header file to transfer an image(*.bmp)
in to my c program.is there any tool for this purpose?
Thank you.
Maryam


Sure, I googled for "bmp information" and found this:

http://astronomy.swin.edu.au/~pbourke/dataformats/bmp/

incredible.
Nov 14 '05 #2

"Maryam" <m_***********@yahoo.com> wrote
I am looking for an include or header file to transfer an image
(*.bmp)
in to my c program.is there any tool for this purpose?

Let's say we have an image file in an arbitrary format. The way to load it
is to write a function

/*
fname - bmp file to open.
width - return pointer for image width.
height - return pointer for image height.
returns - malloced pointer to 24 bit rgb data, NULL on fail.
*/
unsigned char *loadimagebmp(char *fname, int *width, int *height)

The problem comes when the image format, like JPEG, is so complex that you
can't reasonably be expected to decipher it yourself. Here you have to use
non-standard library functions, which may ship with the compiler or you may
cut and paste from the web.

Often you want to embed images in an executable. This is only practical
using some sort of automated tool. Such tools are included in MSVC++, but
are not topical here.
Nov 14 '05 #3
m_***********@yahoo.com (Maryam) wrote:
I am looking for an include or header file to transfer an image(*.bmp)
in to my c program.is there any tool for this purpose?


If I am understanding your requirements correctly, 010 Editor (an
inexpensive Windows application) can do this interactively or
programmatically.

See http://www.sweetscape.com/010editor/

For example, the tool exported a .bmp file exported to a C source
file:

//------------------------------------------------------------
//----------- Created with 010 Editor -----------
//------ www.sweetscape.com/010editor/ ------
//
// File : C:\WINNT\Blue Lace 16.bmp
// Address : 0 (0x0)
// Size : 1272 (0x4F8)
//------------------------------------------------------------
unsigned char hexData[1272] = {
0x42, 0x4D, 0xF8, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0E,
0x00, 0x00, 0xC3, 0x0E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80,
0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80,
0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0xC0, 0xC0,
0xC0, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF,
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF,
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x44, 0x44,
0x44, 0x4C, 0x44, 0x44, 0x44, 0x44, 0xC4, 0xC4,
0x44, 0x44, 0x44, 0x44, 0xC4, 0xC4, 0x44, 0x44,
/* ... */
0x44, 0x44, 0x44, 0x44, 0xC4, 0x4C, 0x44, 0x44,
0x44, 0x44, 0xCC, 0xC4, 0x44, 0x44, 0x00, 0x00
};

--
Dan Henry
Nov 14 '05 #4
Dan Henry <dh****@sprynet.com> wrote:
m_***********@yahoo.com (Maryam) wrote:
I am looking for an include or header file to transfer an image(*.bmp)
in to my c program.is there any tool for this purpose?
See http://www.sweetscape.com/010editor/


In fact, the example screenshots are of an opened BMP file.
For example, the tool exported a .bmp file exported to a C source

^^^^^^^^ ^^^^^^^^
Oops. Normally, the echoes stay within my cranial cavity.

--
Dan Henry
Nov 14 '05 #5
Dan Henry wrote:
m_***********@yahoo.com (Maryam) wrote:
I am looking for an include or header file to transfer an image
(*.bmp) in to my c program.is there any tool for this purpose?
If I am understanding your requirements correctly, 010 Editor (an
inexpensive Windows application) can do this interactively or
programmatically.

.... snip ... 0x42, 0x4D, 0xF8, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x28, 0x00,


If that is what he wants he can do it with debug, which AFAIK
still comes with every Windoze installation, and a little
massaging in any text editor. drdebug, which is available with
drdos, is a little better.

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Nov 14 '05 #6

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

Similar topics

2
by: Bill N. | last post by:
Using VB .Net 2003 Standard Edition. This simple form has a "File in Use" problem while the executable is running. Created this simple program to make sure that I hadn't done something in my...
4
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just...
1
by: Novice | last post by:
I'm afraid I will incur the wraith of Mr. Powell on this one - but I did read his #1 FAQ and some others and I still can't figure this out. I created this little c# app. and I have a PictureBox...
0
by: BATISTA | last post by:
Hi , I am working in c# with crystal report XI. I read an example about dynamic image location .. 1) In that we have a xml xchema file with two fields n amed country--datatype is string,...
3
by: Nathan | last post by:
Hi, I have a project with various forms that each include a number of picture boxes and panels with background images. When these forms first load, they kind of load in "pieces", with the...
6
by: Ivan Bútora | last post by:
I have recently looked at http://alistapart.com/articles/imagegallery to implement a simple picture gallery on a webpage that I'm working on. Everything works fine; however, I have one question....
5
by: toffee | last post by:
Hi all, I've seen a really cool effect which i would like to use on an intranet site. Am referring to the 'LOADING..' animation you see when switching pages. I've seen it somewhere on a website...
0
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and...
0
by: ne0lithic | last post by:
Hey everyone, I'm working on a program based on steganography. For this, i need to access the individual pixels and perform my manipulations. FYI, I do not have the JAI library available with me...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.