473,386 Members | 2,078 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,386 software developers and data experts.

working with smaller images created from big images

I have the following code in which I am attempting to break a large
image up in 16x16 blocks and perform some processing on those blocks.
For debugging I would like to save each of the 16x16 blocks just to
see things working. The original image needs to stay preserved and not
changed through this function. If possible I need to take the graphics/
image object and save it back as a temporary bitmap in the system so I
can perform my image processing algorithms on it. I need to then save
the coordinates of each of these blocks. I stumped on how to make this
work and have been through many attempts...feel I am close but not
quite there yet. Advice would be great.

function xyz (Bitmap bmpSource, int width, int height)
{
int i, j;

for (y = 0; y < width; y++)
{
for (z = 0; z < height; z++)
{
Rectangle rSource = new Rectangle(y, z, 16, 16);
Rectangle rDest = new Rectangle(0, 0, 15, 15);

using (Graphics g = Graphics.FromImage(bmpSource))
{

g.DrawImage(bmpSource,rDest,rSource,GraphicsUnit.P ixel);
g.Save();
}
for (i = 0; i < y; i++)
{
for (j = 0; j < z; j++)
{
Color pixelColor = bmpSource.GetPixel(i,
j);
int r = pixelColor.R; // the Red component
int g = pixelColor.G; // the Green
component
int b = pixelColor.B; // the Blue
component
Color newColor = Color.FromArgb(r, g, b);
output.SetPixel(i, j, newColor);
output.Save(string.Format("C:\\temp\
\outputOF{0}X{1}.bmp", y, z));
}
}
z += 15;
}
y += 15;
}
}
Jan 28 '08 #1
1 1139
On Sun, 27 Jan 2008 17:17:06 -0800, <wv********@gmail.comwrote:
[..]
Problems have been solved. Light bulb came on!
And? Those problems were?

It's customary to, having answered your own question yourself, to post the
answer as a follow-up. This does a couple of things: it helps others to
understand better what your question was in the first place (not always
needed, but in this case I think it would be helpful), and more
importantly it provides a record of your answer in case someone else has a
similar issue and comes across your question searching an archive of the
newsgroup.

Also, it's considered polite behavior to do so.

Pete
Jan 28 '08 #2

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

Similar topics

4
by: Gregory | last post by:
Hello, I've managed to build two web pages, one that can display images with associated text data in a table, and one that can resize and display images without the text. I'd like to resize the...
7
by: codeslayer | last post by:
Greetings to everyone in ‘forum-land': I have a problem that has plaguing me to no end. It is a CSS-related question, and I have not seen this question posted anywhere in forums or through...
9
by: Henri Sivonen | last post by:
URL: http://hsivonen.iki.fi/france-2005/ On the page, markup looks like this: <p class="imgpara"><a href="..."><img src="..." alt="..." height="..." width="..."></a>Caption 1</p> <p...
6
by: Samuel R. Neff | last post by:
I'm trying to put icons in the header of my ListView. All the .net posts I found refer to an example on thecodeproject which is no longer there (part of commercial package now). I converted the...
1
by: Super8Man | last post by:
Hi I tried the max-width hack from Sven Tofte' for IE (http://www.svendtofte.com/code/max_width_in_ie/) But it seems it doesn't work 100% The images are always shown on there max size even if...
3
by: Brian | last post by:
I have a windows forms project done in vb.net. One of the forms creates graphs based on the data supplied to it. I want to take multiple graphs and paste them into a larger Image object. I...
1
by: Stephen.Schoenberger | last post by:
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...
4
by: Sigilaea | last post by:
My previous post got squashed because m post is too long. Sorry for that: I have an AJAX page with a CSS menu at the top. My problem is the hover functionality stops working after someone clicks...
7
by: Poppy | last post by:
I've put together some code to demonstrate what my goal is though looping pixel by pixel it's rather slow. import Image def check_whitespace(): im =...
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: 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
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?
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...

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.