473,385 Members | 1,320 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.

working with images as byte[] arrays

I am working with some images as byte[] arrays and am not sure nor can
I figure out if as I am reading the image and saving smaller sub-
images I am reading across and down the image or down and back up or
randomly? I need to know so in turn I can realize what the coordinates
are of the sub-images. Here is a snippet of the code that is
performing this task...

for (int a = 1; a < 4800; a++) //will create 4800 sub images if a
goes to numsubimages
{
Bitmap tempbitmap;
//this declares the size of tbyte to be 768 which is
the number of bytes needed for 16x16 sub image
byte[] tbyte = new byte[(stride * height) / ((height /
16) * (width / 16))];
byte[] holding2 = new byte[tbyte.Length];

for (int b = 1; b < tbyte.Length; b++)
{
tbyte.Initialize();
byte holding = (byte) bytebitmap.GetValue(b*a);
tbyte.SetValue(holding, b);

}
tempbitmap = BytesToBmp(tbyte, tempSize); //save the
output of the 16x16 sub image so results can be seen
}

BytesToBmp is simply a function that coverts a byte array into a
bitmap image.

Thanks!
Feb 7 '08 #1
1 2205
On Feb 7, 1:14*pm, Stephen.Schoenber...@gmail.com wrote:
I am working with some images as byte[] arrays and am not sure nor can
I figure out if as I am reading the image and saving smaller sub-
images I am reading across and down the image or down and back up or
randomly? I need to know so in turn I can realize what the coordinates
are of the sub-images. Here is a snippet of the code that is
performing this task...

*for (int a = 1; a < 4800; a++) //will create 4800 sub images if a
goes to numsubimages
{
* * * * * * * * Bitmap tempbitmap;
* * * * * * * * //this declares the size of tbyte to be 768 which is
the number of bytes needed for 16x16 sub image
* * * * * * * * byte[] tbyte = new byte[(stride * height) / ((height /
16) * (width / 16))];
* * * * * * * * byte[] holding2 = new byte[tbyte.Length];

* * * * * * * * for (int b = 1; b < tbyte.Length; b++)
* * * * * * * * {
* * * * * * * * * * tbyte.Initialize();
* * * * * * * * * * byte holding = (byte) bytebitmap..GetValue(b*a);
* * * * * * * * * * tbyte.SetValue(holding, b);

* * * * * * * * }
* * * * * * * * tempbitmap = BytesToBmp(tbyte, tempSize); //save the
output of the 16x16 sub image so results can be seen

}

BytesToBmp is simply a function that coverts a byte array into a
bitmap image.

Thanks!
What is the input file type? I don't think this method would work for
a compressed image file like JPG.
Feb 7 '08 #2

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

Similar topics

1
by: Eric Hendriks | last post by:
// In an unmanaged DLL the following function must be called: // int VFGeneralize(const BYTE * const * features); // "features" parameter is supposed to be an array of byte arrays. // function is...
10
by: Eric Eggermann | last post by:
Hello all, I'm looking for a way to tell whether two image objects which do not have object equality are the same image or not, and I mean identical, say originally loaded from the same file. Any...
8
by: Ben Terry | last post by:
What's the most efficient way to transfer data from a byte to a struct? The struct is rather complex--contains other structs as well as byte members. I've tried to use Marshal.Copy and an IntPtr...
7
by: Joseph Lee | last post by:
Hi All, I am having problem when i am using hashtable to keep an array of bytes value as keys. Take a look at the code snippet below --------------------------------------------------- ...
3
by: mraj | last post by:
Hello... I am new to C#. My requirement is that, I will receive over 100s of images from the network to local machine and display these images on an image viewer one by one on mouse scroll. To...
3
by: Jordan Bowness | last post by:
Can anyone tell me why this doesn't work? It appears to post, but my ..asp page I use to retieve the image pulls up nothing. Here's the posting snippet: ======= begin =======
3
by: Alan | last post by:
Hi, I'm converting a database application from Access 97 to C#/SQL Server. Old database contains some images in OLE fields. I've figured out that there's OLE header preceeding actual image data...
8
by: den 2005 | last post by:
Hi everybody, I am not sure where to put this in this forum. So, I posted this at several topics. I created a class library that has two public methods Encrypt() and Decrypt(). I reference this...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.