Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

First of all is there a way to load images in 3 dimensional matrices ? As in matlab?
Here is a piece of a matlab 'script' I made to make a puzzle from an images:

```function [] = puzzel(naam, N);
resolutie = size(afb);
afm = resolutie(1);

x = sqrt(N);

for i = 1:3
for j=1:afm/x
for k=1:afm/x
afb(afm-afm/x+j,afm-afm/x+k,i) = 0;
end;
end;
end;

randm = fix(rand(1)*40+10)
for o = 1:randm
hop1= floor(rand*(x))+1;
hop2= floor(rand*(x))+1;
hip1= floor(rand*(x))+1;
hip2= floor(rand*(x))+1;
for i = 1:3
for j=1:afm/x
for k=1:afm/x
im1 = afb(afm-hop1*afm/x+j,afm-hop2*afm/x+k,i);
im2 = afb(afm-hip1*afm/x+j,afm-hip2*afm/x+k,i);
afb(afm-hop1*afm/x+j,afm-hop2*afm/x+k,i) = im2;
afb(afm-hip1*afm/x+j,afm-hip2*afm/x+k,i) = im1;
end;
end;
end;
end;
image(afb);```

Now as you can see, afb contains the image, and afb is a 3 dimensional matrix : ) x:y:1 -> red x:y:2 -> green, etc

Is there a way to do the same with java?

Another thing, if there is a way (of if there isn't, referring to the previous question).
Is there a way to load the image that is currently in your clipboard ?

Greetings,
Pieter

Loading things from the Clipboard can sometimes be a pain, but look at the Clipboard (Java 2 Platform SE 5.0).If you are doing this through an applet you will most likely have security issues in which you must sign the applet for Clipboard access.

As far is a 3D image, I don't think Java has a standard class, but you could create your own through either arrays representing the 3D architecture of the RGB values, or create an array of BufferedImage (Java 2 Platform SE v1.4.2)

Originally Posted by copeg
Loading things from the Clipboard can sometimes be a pain, but look at the Clipboard (Java 2 Platform SE 5.0).If you are doing this through an applet you will most likely have security issues in which you must sign the applet for Clipboard access.

As far is a 3D image, I don't think Java has a standard class, but you could create your own through either arrays representing the 3D architecture of the RGB values, or create an array of BufferedImage (Java 2 Platform SE v1.4.2)
Since I have no experience with images in java I'll give that bufferedimages a try.

Btw, 3d images? Are you sure you know what I meant..? The images are clearly just 2d, but they get represented by a 3d matrix, because every pixel get's represented by 3 colours, red green blue, anyway, I'll do some research on that

`BufferdImage image = ImageIO.read(new File("/local/path/to/your/image"));`