Skip to main content

[JAI] How to save a cropped image in a file?

1 reply [Last post]
Anonymous

I'm on a task to segment an image into different frames which I did using the
ParameterBlock.
ParameterBlock params = new ParameterBlock();
params.addSource(image);
params.add(X coordinate);//x origin
params.add(Y coordinate);//y origin
params.add(width);//width
params.add(height);//height
result= JAI.create("crop", params);
And I find that the image is cropped as per the coordinates i have given as
input(verified the output using Swing concept)
But the problem arises when I try to write into the file using
String fileName = "address";
File output1 = new File(fileName);
ImageIO.write(result,"jpg", output1);

The image which is stored in the addressed file start and end with different
coordinates i.e IT IS NOT THE REGION OF INTEREST.
But i verified that the width and height of the stored cropped image is as
per desired (but not the coordinates)
I understand that whatever values are being given in x,y. It just takes
x=0,y=0.

Can anyone please help me to overcome this problem of storing the desired
cropped image in a file.
Thanking in advance,
Best Wishes.
--
View this message in context: http://old.nabble.com/How-to-save-a-cropped-image-in-a-file--tp27982479p...
Sent from the JAI Projects - Interest mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
loki der quaeler

It seems like someone else with your coincidentally same problem
(school assignment?) concerning x,y offset cropping was just posting
to the list earlier today - http://forums.java.net/jive/thread.jspa?messageID=393038

On Mar 21, 2010, at 10.12 PM, need2knwjai wrote:

>
> I'm on a task to segment an image into different frames which I did
> using the
> ParameterBlock.
> ParameterBlock params = new ParameterBlock();
> params.addSource(image);
> params.add(X coordinate);//x origin
> params.add(Y coordinate);//y origin
> params.add(width);//width
> params.add(height);//height
> result= JAI.create("crop", params);
> And I find that the image is cropped as per the coordinates i have
> given as
> input(verified the output using Swing concept)
> But the problem arises when I try to write into the file using
> String fileName = "address";
> File output1 = new File(fileName);
> ImageIO.write(result,"jpg", output1);
>
> The image which is stored in the addressed file start and end with
> different
> coordinates i.e IT IS NOT THE REGION OF INTEREST.
> But i verified that the width and height of the stored cropped image
> is as
> per desired (but not the coordinates)
> I understand that whatever values are being given in x,y. It just
> takes
> x=0,y=0.
>
> Can anyone please help me to overcome this problem of storing the
> desired
> cropped image in a file.
> Thanking in advance,
> Best Wishes.
> --
> View this message in context: http://old.nabble.com/How-to-save-a-cropped-image-in-a-file--tp27982479p...
> Sent from the JAI Projects - Interest mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net