i need to copy the pixels from one image to another not all the pixels
int copy(image2,i,j,image1 k,j)
and return the image2
how to write the function completely

Recommended Answers

All 3 Replies

What are image2, image1? Are they arrays? Paths? What format are the images? What do i,j, and k represent? You need to more clearly define the problem and show what you've already done. There are libraries available that support different formats, but you should be specific about what you need.

it is a greyscale image,im not using any library,trying to write the code in c,i and j are the coordinates of image1, k and j are the coordinates of image2,i have to copy the pixel of image1 to image2

1) You have to get the format of the pixel, in that type of picture - and there are many types of greyscale. You can google the format.

2) Make the number of variables (and type - probably unsigned char, but it could be int), you need, to correspond to your pixel's format.

3) write out the new data with the changes you made. Don't try to actually alter the file, in place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.