Smart questions
Smart people
 Find A ForumFind An Expert
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Remember Me

Are you an
Engineering professional?
Join Eng-Tips now!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Just copy and paste the

#### Feedback

"...The forum looks great! You guys have done a fantastic job on arranging things there...Your site is very precise and fun to visit..."

#### Geography

Where in the world do Eng-Tips members come from?

# problem scrambling a picture- only grayscale

 Forum Search FAQs Links Jobs Whitepapers MVPs
 fibonacci1984 (Bioengineer) 2 Jul 12 6:41
 Hi, I would like to modify a full colored picture making it scrambled. My problem is that matlab gives me a gray scale picture when I enter a full colored picture. Here is the function.... hope somebody can help me function newim = scrambled(im,n) mn = floor(size(im)/n); m1 = mn(1); n1 = mn(2); newim = zeros(m1*n,n1*n); ind = randperm(m1*n1); [ind1,ind2] = ind2sub([m1,n1],ind); for k = 1:m1*n1 [i,j] = ind2sub([m1,n1],k); newim((i-1)*n+1:i*n,(j-1)*n+1:j*n) = ... im((ind1(k)-1)*n+1:ind1(k)*n,(ind2(k)-1)*n+1:ind2(k)*n); end
 flash3780 (Mechanical) 23 Dec 12 13:40
I've not done this in Matlab, but it's pretty easy with ImageMagick.
For example, I can take this picture of my dog,

And scramble it:

#### CODE --> ImageMagick

`convert test.png -encipher passphrase.txt test2.png `
Which produces:

To descramble, simply use:

#### CODE --> ImageMagick

`convert test2.png -decipher passphrase.txt test3.png `
Which gets you back to:

Check out the ImageMagick help page here: http://www.imagemagick.org/script/cipher.php
You should be able to do the above with a system call from Matlab.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!