This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cropping image in a servlet

Leonardo Ligas
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a problem with image cropping, i use jcrop and a java servlet.
in my servlet the image is cropped correctly but the top
left x and y coordinate of the result rectangle is always equal to the 0,0
coordinate of the source rectangle, example:

with this code:

doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int x = new Integer( request.getParameter("x"));//
int y = new Integer( request.getParameter("y"));
BufferedImage File("..........");
BufferedImage cropped=outImage.getSubimage(x, y, w, h);
ImageIO.write(cropped,ext, new File("...."));

I get always as result an image tath is cropped from x and y equal to 0 0.
i have checked x and y and they are not equal to 0.

Can you help me?
thank you
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic