RSS/Atom feed Twitter
Site is read-only, email is disabled

Enhancement - Diagonal line crop guide

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

7 of 7 messages available
Toggle history

Please log in to manage your subscriptions.

Enhancement - Diagonal line crop guide Tim Jedlicka 07 Nov 05:03
  Enhancement - Diagonal line crop guide Martin Nordholts 07 Nov 17:14
   Enhancement - Diagonal line crop guide Martin Nordholts 07 Nov 17:30
  Enhancement - Diagonal line crop guide Sven Neumann 12 Nov 21:29
   Enhancement - Diagonal line crop guide Liam R E Quin 04 Feb 23:13
Enhancement - Diagonal line crop guide Tim Jedlicka 11 Nov 09:10
  Enhancement - Diagonal line crop guide Martin Nordholts 11 Nov 10:00
Tim Jedlicka
2007-11-07 05:03:41 UTC (over 16 years ago)

Enhancement - Diagonal line crop guide

(repost - got lost somewhere the first time)

I stumbled upon this link describing the use of the Diagonal (45 degree diagonal from each corner of an image) as the optimum crop guide ("better" than rule-of-thirds or golden rule).

http://www.diagonaalmethode.nl/

I hacked together a patch to add the Diagonal crop guide. So, should I open an enhancement bugzilla and include the patch? My patch isn't perfect - hence posting here since it requires some discussion. If the crop box is a portrait, then it works, if landscape (X > Y) then the guides extend beyond the crop rectangle. I don't know how to fix this cleanly (using an if statement doesn't seem efficient).

Any guidance (on or off list) would be appreciated. Thanks...Tim

Martin Nordholts
2007-11-07 17:14:34 UTC (over 16 years ago)

Enhancement - Diagonal line crop guide

Tim Jedlicka wrote:

(repost - got lost somewhere the first time)

I stumbled upon this link describing the use of the Diagonal (45 degree diagonal from each corner of an image) as the optimum crop guide ("better" than rule-of-thirds or golden rule).

http://www.diagonaalmethode.nl/

I hacked together a patch to add the Diagonal crop guide. So, should I open an enhancement bugzilla and include the patch? My patch isn't perfect - hence posting here since it requires some discussion. If the crop box is a portrait, then it works, if landscape (X > Y) then the guides extend beyond the crop rectangle. I don't know how to fix this cleanly (using an if statement doesn't seem efficient).

Any guidance (on or off list) would be appreciated. Thanks...Tim

Hi Tim, we appreciate your efforts.

This should be solvable without caring about if the rectangle is in portrait or landscape. For each line to draw, you have

1. one starting point (a corner, e.g. upper left) 2. one direction (e.g. 45 degrees down to the right for the upper left corner)
3. another line (e.g. the bottom horizontal line for the upper left corner)

Now you need to calculate the end point by calculating where the 45 degree line intersects with other line. Then draw a line between the start point and the calculated intersection point.

Martin Nordholts

Martin Nordholts
2007-11-07 17:30:35 UTC (over 16 years ago)

Enhancement - Diagonal line crop guide

Martin Nordholts wrote:

Tim Jedlicka wrote:

(repost - got lost somewhere the first time)

I stumbled upon this link describing the use of the Diagonal (45 degree diagonal from each corner of an image) as the optimum crop guide ("better" than rule-of-thirds or golden rule).

http://www.diagonaalmethode.nl/

I hacked together a patch to add the Diagonal crop guide. So, should I open an enhancement bugzilla and include the patch? My patch isn't perfect - hence posting here since it requires some discussion. If the crop box is a portrait, then it works, if landscape (X > Y) then the guides extend beyond the crop rectangle. I don't know how to fix this cleanly (using an if statement doesn't seem efficient).

Any guidance (on or off list) would be appreciated. Thanks...Tim

Hi Tim, we appreciate your efforts.

This should be solvable without caring about if the rectangle is in portrait or landscape. For each line to draw, you have

1. one starting point (a corner, e.g. upper left) 2. one direction (e.g. 45 degrees down to the right for the upper left corner)
3. another line (e.g. the bottom horizontal line for the upper left corner)

Now you need to calculate the end point by calculating where the 45 degree line intersects with other line. Then draw a line between the start point and the calculated intersection point.

Martin Nordholts

Oops, it of course depends on portrait or landscape which line you hit first. I think you will have to throw in an if there.

- Martin Nordholts

Tim Jedlicka
2007-11-11 09:10:32 UTC (over 16 years ago)

Enhancement - Diagonal line crop guide

Martin Nordholts wrote:

* Tim Jedlicka wrote:**

*>>*
*>>* I stumbled upon this link describing the use of the Diagonal (45 degree *>>* diagonal from each corner of an image) as the optimum crop guide ("better" *>>* than rule-of-thirds or golden rule). ...
*

Oops, it of course depends on portrait or landscape which line you hit first. I think you will have to throw in an if there.

I figured out a way to avoid the "if" statement. However, I don't know which method would be more efficient. i.e. should I try to avoid the "if"? These diagonal crop guides are very dynamic as you change your crop rectangle so I don't want to bog down the rendering. Just need some guidance on which route to take. I'll then have some follow up questions since I am not much of a coder (I'll do this off list unless directed otherwise).

gimpregionselecttool.c has this bit of code when selecting a region: /* don't let the events come in too fast, ignore below a delay of 100 ms */
if (time - last_time < 100)
return;

last_time = time;

diff_x = coords->x - region_sel->x; diff_y = coords->y - region_sel->y;

diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;

So there "if" doesn't look like it is too costly.

The way I came up with to avoid the "if" is (pseudo code):

X = x2-x1 Y = y2-y1
Z = [(X + Y) - ABS (X - Y)] / 2
So the upper left diagonal would go from x1,y1 to (x1 + Z), (y1 + Z)

Any advice on which way to implement?

Martin Nordholts
2007-11-11 10:00:01 UTC (over 16 years ago)

Enhancement - Diagonal line crop guide

Tim Jedlicka wrote:

Martin Nordholts wrote:

Oops, it of course depends on portrait or landscape which line you hit first. I think you will have to throw in an if there.

I figured out a way to avoid the "if" statement. However, I don't know which method would be more efficient. i.e. should I try to avoid the "if"? These diagonal crop guides are very dynamic as you change your crop rectangle so I don't want to bog down the rendering. Just need some guidance on which route to take. I'll then have some follow up questions since I am not much of a coder (I'll do this off list unless directed otherwise).

gimpregionselecttool.c has this bit of code when selecting a region:

[...]

So there "if" doesn't look like it is too costly.

The way I came up with to avoid the "if" is (pseudo code):

X = x2-x1 Y = y2-y1
Z = [(X + Y) - ABS (X - Y)] / 2
So the upper left diagonal would go from x1,y1 to (x1 + Z), (y1 + Z)

Any advice on which way to implement?

We can keep this on-list so other people can jump in the they wish to.

From a performance point of view it is completely negligible to use an

if. The time it takes to do the actual rendering of a line is orders of magnitude larger than having a conditional statement when calculating what coordinates to use.

So the method of calculating what coordinates to use basically boils down to using the method that gives the most readable code, and I would say making use of an if is the most natural approach.

- Martin Nordholts

Sven Neumann
2007-11-12 21:29:50 UTC (over 16 years ago)

Enhancement - Diagonal line crop guide

Hi,

On Tue, 2007-11-06 at 23:03 -0500, Tim Jedlicka wrote:

I stumbled upon this link describing the use of the Diagonal (45 degree diagonal from each corner of an image) as the optimum crop guide ("better" than rule-of-thirds or golden rule).

http://www.diagonaalmethode.nl/

I didn't find that article very convincing. So I would like to get some positive feedback from artists before we add yet another Crop guides option.

Sven

Liam R E Quin
2008-02-04 23:13:05 UTC (about 16 years ago)

Enhancement - Diagonal line crop guide

On Mon, 2007-11-12 at 21:29 +0100, Sven Neumann wrote:

On Tue, 2007-11-06 at 23:03 -0500, Tim Jedlicka wrote:

I stumbled upon this link describing the use of the Diagonal (45 degree diagonal from each corner of an image) as the optimum crop guide ("better" than rule-of-thirds or golden rule).

http://www.diagonaalmethode.nl/

This has been a rule of composition since the Middle Ages. Probably I can find you some references. Tschicholde's page layout diagrams, and Leonardo's writing, may help.

But I am not sure that 45 degree lines from the corners of the crop rectangle would be sensible.

It might be better to allow diagonal guides, and have the corners of the crop box have a "snap to guides" behaviour, rather than build into the crop tool every possible kind of proportion.

You'd position the diagonals according to the image features, and then crop.

Liam