Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35042

Re: What do you think of my CropImage class

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.java.programmer
Subject Re: What do you think of my CropImage class
Date 2016-07-21 11:58 +0200
Organization Decebal Computing
Message-ID <8737n36ucx.fsf@Equus.decebal.nl> (permalink)
References <87twfk93vu.fsf@Equus.decebal.nl>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I was not completely clear :'-( so here some more info.

I have no real experience with Swing and had an itch to scratch.
That is why I wrote this program: to get some experience with
Swing and get a little tool to make my live a little easier.

At the moment it is the first try: there is a lot that could be done
much better, but at least this makes live a little easier for me.

The problem is that I like to crop part of a photo to post on
Instagram. For example:
    https://www.instagram.com/p/BIGN8pjACDT/
and:
    https://www.instagram.com/p/BIGNtrpAmnT/

The first is not perfect, because the leg of the frog is cut of, but I
want to have a one on one crop to keep the quality of the picture. (Or
a 2, 3, 4 on 1 crop, but that is for a next step.)

To show what I mean see the picture in the link. Sometimes a picture says
more as a thousand words. ;-)

https://drive.google.com/file/d/0BzW5q7uL-6z0XzNJb0FSRFFxMDA/

Gimp does not work (at least for me), because I have to crop exactly a
piece of 1080x1080. I do not know how to do this with Gimp. Also when it
is not correct I need to draw again, with the program I have just to
move the cursor a little and click again. Would be better when I could
drag the square, but again: this is just my first try.


A rundown of what the program does:

When it starts it asks for a graphic file to be displayed. It displays
this with both the width and height divided by eight because I want to
see the complete picture.

The program displays a square of 135x135 in the upper left corner. When
multiplied by 8 this gives the wanted 1080x1080.

By clicking in the picture the square is moved to select the part of the
picture I want to crop.

By clicking on crop a file is selected to save the selected area and the
saved part is displayed. The displaying of the selected part is done
without re-sizing because I want to see exactly what I did select and it
can almost be displayed on my screens.

If I am satisfied with the cropped image I can click load to start with
the next picture.


What needs to be improved:

- It should be system independent. For me pack did not work, so I put
  things on a hard coded position. This will probably be no problem when
  it is run on another Linux machine, but could wreck havoc on a Windows
  machine.
- I should know if the image is rotated, so I could rotate the cropped
  image also. Maybe this is not really important, because I am thinking
  about putting all pictures in a SQLite database and then the rotation
  will also be stored.
- After loading an image the first click results in flicker. This should
  be solved.
- I want to have the possibility to add comment to the picture. (EXIF)
- It now only works with the primary dimensions of Instagram, but it
  should also work with the other two. After this it should also work
  with the dimensions of the other Social Media and it should be
  possible to add your own custom dimensions. (SQLite to the rescue.)
- Possibility to resize. (Select an area of 2.160x2.160 and crop it to
  1.080x1.080).
- Instead of clicking it should work with dragging the square (or
  rectangle).
- Probably a lot of other things. :-D I am open to suggestions.


On Wednesday 20 Jul 2016 09:15 CEST, Cecil Westerhof wrote:

> I need to crop some images and decide to write a Java program for
> it. At the moment it is very rudimentary, I plan to add some
> functionalities and because I have very little experience with GUI
> comments on how to implement the GUI better are welcome.
>
>
> At the moment it is build with my camera's in mind and cropping for
> InstaGram, but when it is seen as useful I will make it more
> generic.
>
>
> I have a few problems, the most important are: - After loading the
> first or a new image the first click makes the image disappear and
> painted again. Subsequent clicks do not have this problem. - The
> original photo can be rotated. How can I find this out and make the
> cropped image also rotated? - How can I add comment to an image? -
> After saving the cropped image I want to display it also. What would
> be the best way to do this?
>
> Some of the functionalities I want to add (other ideas are welcome):
> - Working with different sets of cropping. - Possibility to resize.
> (Select an area of 2.160x2.160 and crop it to 1.080x1.080). -
> Working with a database.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-20 09:15 +0200
  Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-20 11:12 +0200
  Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-20 10:02 -0700
    Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-20 21:14 +0200
      Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-20 12:50 -0700
        Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:11 +0200
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 14:19 +0200
      Re: What do you think of my CropImage class Qu0ll <qu0ll64@gmail.com> - 2016-07-21 05:53 +1000
      Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-20 13:46 -0700
        Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-20 13:59 -0700
          Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-20 15:40 -0700
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:27 +0200
            Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 05:17 -0700
              Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 17:43 +0200
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 08:59 -0700
                Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 19:10 +0200
                Re: What do you think of my CropImage class Arne Vajhøj <arne@vajhoej.dk> - 2016-07-23 21:47 -0400
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-25 04:51 -0700
                Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-25 15:01 -0700
                Re: What do you think of my CropImage class Arne Vajhøj <arne@vajhoej.dk> - 2016-07-25 21:06 -0400
                Re: What do you think of my CropImage class Arne Vajhøj <arne@vajhoej.dk> - 2016-07-25 21:09 -0400
            Re: What do you think of my CropImage class Nigel Wade <nmw@local.domain> - 2016-07-21 15:44 +0100
              Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 17:46 +0200
        Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:25 +0200
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 14:16 +0200
    Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 12:05 +0200
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 13:23 +0200
      Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-21 07:58 -0700
        Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 11:13 -0400
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 18:12 +0200
        Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 17:49 +0200
  Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 11:58 +0200
    Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 09:35 -0400
      Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 09:03 -0700
        Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 12:39 -0400
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 18:07 +0200
        Re: What do you think of my CropImage class Nigel Wade <nmw@local.domain> - 2016-07-21 17:23 +0100
        Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 12:56 -0400
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 19:03 +0200
        Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 10:25 -0700
          Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 14:24 -0400
            Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 11:54 -0700
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 20:25 +0200
            Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 15:37 -0400
              Re: What do you think of my CropImage class Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-21 21:30 +0000
              Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 23:52 +0200
                Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 20:35 -0400
                Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-22 04:21 +0200
                Re: What do you think of my CropImage class Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-21 22:44 -0400
                Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-22 10:27 +0200
                Re: What do you think of my CropImage class Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-22 10:47 +0000
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-22 05:16 -0700
                Re: What do you think of my CropImage class Nigel Wade <nmw@local.domain> - 2016-07-22 15:10 +0100
                Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-22 07:47 -0700
                Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-22 10:21 -0700
    Re: What do you think of my CropImage class Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2016-07-21 08:30 -0700
      Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 18:19 +0200
        Re: What do you think of my CropImage class Eric Douglas <e.d.programmer@gmail.com> - 2016-07-21 10:18 -0700
          Re: What do you think of my CropImage class Cecil Westerhof <Cecil@decebal.nl> - 2016-07-21 20:12 +0200

csiph-web