Thread: Help with shifting blocks( 24-bit BMP image

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    10

    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
    Last edited by abujdan; 04-17-2011 at 01:44 AM.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    250
    How about something like this?

    Code:
    if user pressed key1
            shift_all_pixels_right()
    if user pressed key2
            shift_all_pixels_left()
    iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
    justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    10
    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. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > 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?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    10
    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. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 03-13-2010, 05:10 AM
  2. merge multiple image file into one image
    By mr_empty in forum C++ Programming
    Replies: 7
    Last Post: 12-09-2009, 02:12 PM
  3. Replies: 13
    Last Post: 11-20-2009, 04:43 PM
  4. Problems with Image Magick [Unable to Quantisize Image]
    By Maragato in forum C Programming
    Replies: 1
    Last Post: 09-18-2006, 10:41 PM
  5. Shifting an image down a row
    By slowcoder in forum C Programming
    Replies: 19
    Last Post: 08-02-2006, 11:13 PM

Tags for this Thread