Hello people
am working on bmp files and i am given a task of detecting the color form the bmp file....so i converted the bmp file in hex file that is .bin file and now it is becoming a pain to serch for the color red in the bin file....could anyone plz suggest me a way as to how to read the bin file and how to serch for the red color in the file...
hope to find some solution...
6 1974
Thank you for the response....but what i have worked on is that i have removed the header file in the .bin file...what i mean to say is that the .bin file that i am workin on does not have the header.(coz i have removed it...)..now i want to search this resulting bin file and find out the color...that is red... any code to locate the color red will be very much appreciated.....
Regrds
Ranjit
Hi,
Can I know what is the format the data stored in the bin file.
i.e., RGBA, ARGB or just RGB.
R Stands for Red,
G Stands for Green,
B Stands for Blue and
A Stands for Alpha.
Regards,
M.Sivadhas.
hi
It is in RGB format.....
Thanks a lot ...
Regards
Ranjit
Hai ranjitneo
The color is stored as BGR If it is a 24 bit and 4th byte is reserved.
B = Blue
G = Green
R = Red
.
Well, you could just read the file using any one of the bitmap libraries out there, and directly access the pixels.
If you want info on the BMP file format, I'd look here: http://www.fortunecity.com/skyscrape.../bmpffrmt.html
It will tell you how many bytes you need to strip out until you reach the first amount of data. If it's not a 24-bit or 32-bit image, however, it will be a bit more difficult. (color tables and/or bit masks, etc.)
That reference was particularly helpful to me for writing my own bitmap library.
( EasyBMP)
If you choose to use that, it's as follows: -
...
-
#include "EasyBMP.h"
-
..
-
-
// declare and read an image
-
-
BMP Image;
-
Image.ReadFromFile( "my_image.bmp" );
-
-
// get info on pixel (3,12)
-
-
cout << "Pixel (3,12) : ("
-
<< Image(3,12)->Red << " , "
-
<< Image(3,12)->Green << " , "
-
<< Image(3,12)->Blue << ")" << endl;
-
-
// change pixel (4,3) to the color (255,0,128):
-
-
Pixel(4,3)->Red = 255;
-
Pixel(4,3)->Green = 0;
-
Pixel(4,3)->Blue = 128;
-
-
// save the modified image
-
-
Image.WriteToFile( "modified_image.bmp" );
-
That's it. :) -- Paul
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: hokieghal99 |
last post by:
import os, string
print " "
setpath = raw_input("Enter the path: ")
def find_replace(setpath):
for root, dirs, files in os.walk(setpath):
fname = files
for fname in files:
find =...
|
by: Bart Nessux |
last post by:
x = str.find(temp, '120.50')
I am looking for '120.50' '120.51' '122.78' etc. How can I do this with
just one str.find... I can use re if I must, but I'd like to avoid it if
possible.
|
by: Peter Hansen |
last post by:
Greetings.
Im trying to write a program that can be run from the command line.
If I want to search for example after a file with the ending .pdf, I should
be able to write in the command line:...
|
by: Xah Lee |
last post by:
suppose you want to do find & replace of string of all files in a
directory.
here's the code:
©# -*- coding: utf-8 -*-
©# Python
©
©import os,sys
©
©mydir= '/Users/t/web'
|
by: Pierre-Yves |
last post by:
Hello,
I have to loop recursively in directories to build a tree. Based on the
directory name, I know I can skip some (i.e: the BACKUP ones) to improve the
performances that are currently very...
| |
by: Dan Jones |
last post by:
I'm writing a script to process a directory tree of images.  In each
directory, I need to process each image and generate an HTML file listing
all of the images and links to the subdirectories....
|
by: Harsha |
last post by:
I have been working on VB, ASP for quite a long time. Very Recently (
From past 1 month) I am managing a VC++ project. I am trying to use
the code which i downloaded from the internet to find the...
|
by: mirandacascade |
last post by:
I do not understand how to use the find() method in ElementTree.
The file 'sample.xml' is:
<?xml version="1.0"?>
<SampleRoot>
<Header>
<Product>FindMystery</Product>
</Header>...
|
by: Tim Eliot |
last post by:
Just wondering if anyone has hit the following issue and how you might
have sorted it out.
I am using the command:
DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True
after...
|
by: Xiangliang Meng |
last post by:
Hi, all.
Recently, I find there is a way in our project to maintain a global set in
many files by using preprocessing directives. I'm wondering if we could find
a better method for this.
Many...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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...
|
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |