# Help with shifting blocks( 24-bit BMP image

This is a discussion on Help with shifting blocks( 24-bit BMP image within the C Programming forums, part of the General Programming Boards category; Hello, I was wondering if anyone could give an idea as to how i can Shift all the positions of ...

1. ## Help with scrambling a 24 bit BMP image by shifting blocks(pixels)

Hello,
I was wondering if anyone could give an idea as to how i can Shift all the positions of pixels in a 24-bit BMP image by the use of a key(s) such that once the same key(s) is given again to the scrambled image I can get back the image in its original shape...the key needs to be provided by the user...I just want your opinions....not the code

2. How about something like this?

Code:
```if user pressed key1
shift_all_pixels_right()
if user pressed key2
shift_all_pixels_left()```

3. Thank you MWAAAHAAA for your reply....I was thinking may be using some modulus( % ) operation on every row with the use of the key the image can be scrambled......Could u give me a solution with respect to that....Such that if a row gets the value of a row number no other row can get the same....

4. > I just want your opinions....not the code
...
> Could u give me a solution with respect to that

Now, which one do you really want?
Are you here to learn something, or just looking to score some free homework?

5. I just want someone to give me an approach Salem.....If u do have an approach like MWAAAHAAA can u please do post them...Thank U

6. How do you intend the shift to work? You can view each row in the picture as an array of "pixels", which might be a struct with a R,G,B value. So, a shift can be done in the same manner you would shift the content of any array, by copy and move. Watch out for any padding, which needs to stay at the same position. You can use modulus as you suggested to have the upper bound on your row to "wrap around" and give an index in the beginning of the row.