JAI example of cropping

A

Andrew Neiderer

I have done little Java Advanced Image (JAI) processing; mostly I work in
Java3D and Java. But I do have access to JAI libraries for image processing.

I have a 368 x 198 texture that I need to place on some Java3D terrain.
Both the geometry and appearance nodes for a Shape3D have been implemented.
But I believe the texture needs to have dimensions in powers of 2, e.g.
512 x 256. So I need to crop/scale the 368 x 198 JPEG before placing
on the geometry.

Can someone point me (URL) or provide JAI code to an example.
I did a google search but could not find an example. Or if I should ask
at a Sun website, please advise on which one.

Thank you.

- Andrew M. Neiderer
US Army Research Lab
 
A

Advocate for murdered civilians

Can someone point me (URL) or provide JAI code to an example.
I did a google search but could not find an example. Or if I should ask
at a Sun website, please advise on which one.

Thank you.

- Andrew M. Neiderer
US Army Research Lab

What, so that we can help you automate the visualization of innocent
civilians you and your colleagues intend to bomb from great heights ??!!!!!

Go **** yourself, you and anyone who buys your "Pax Americana" brainwashed
shit.
 
M

Martin Trobec

Andrew Neiderer said:
I have done little Java Advanced Image (JAI) processing; mostly I work in
Java3D and Java. But I do have access to JAI libraries for image
processing.

I have a 368 x 198 texture that I need to place on some Java3D terrain.
Both the geometry and appearance nodes for a Shape3D have been
implemented.
But I believe the texture needs to have dimensions in powers of 2, e.g.
512 x 256. So I need to crop/scale the 368 x 198 JPEG before placing
on the geometry.

Can someone point me (URL) or provide JAI code to an example.
I did a google search but could not find an example. Or if I should ask
at a Sun website, please advise on which one.

Thank you.

- Andrew M. Neiderer
US Army Research Lab

This code worked for me using jai api, vintage 2003,

RenderedImage ri = JAI.create("fileload",pathandfilename);

public void crop()
{
pb = new ParameterBlock();
pb.addSource(ri);
pb.add((float)topLeftmx);
pb.add((float)topLeftmy);
pb.add((float)roiWidth);
pb.add((float)roiHeight);
ri = JAI.create("crop",pb);
}

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top