Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: What do you think of my CropImage class Date: Thu, 21 Jul 2016 12:05:22 +0200 Organization: Decebal Computing Lines: 54 Message-ID: <87vazz71ct.fsf@Equus.decebal.nl> References: <87twfk93vu.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="12baf5125b19322b899c79c2e3878015"; logging-data="5964"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+T/vAytZuimb3m/iHatnyhVT9fZbffX9I=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:3cjhryBZaAwK5meF+LeQbxjLJeM= sha1:5yWihIzRACcEkmIh9nFzGa0hgS8= Xref: csiph.com comp.lang.java.programmer:35033 On Wednesday 20 Jul 2016 19:02 CEST, Knute Johnson wrote: > On 7/20/2016 00:15, Cecil Westerhof wrote: >> - The original photo can be rotated. How can I find this out and >> make the cropped image also rotated? > > That's in the image meta data (I have no clue how to find it) Yes, it is in the image data. I could find it with Image Magick, but I like this to be pure Java. >> - How can I add comment to an image? > > You want to draw on the image or add meta data? Add meta data (EXIF). >> - After saving the cropped image I want to display it also. What >> would be the best way to do this? > > In another window maybe Already done. Was easier as I thought. ;-) > Here's a crop component that I wrote years ago, I don't think I ever > used it for anything but I can't remember. > subImage = CropComponent.this.bi.getSubimage(x,y,w+1,h+1); That is a lot better as what I did. I should implement it. > Runnable r = new Runnable() { > public void run() { > try { > ImageIO.write(subImage,"JPEG",new > File("crop.jpg")); > } catch (IOException ioe) { > ioe.printStackTrace(); > } > } > }; > new Thread(r).start(); Why are you doing this in a separate thread? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof