Image Cropping Tool for Livecode

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Image Cropping Tool for Livecode

Sivakatirswami
As anyone created a image cropping tool for LiveCode? If so can you send
me your stack/code or put it on line? Thanks!


Om Shanti
Sivakatirswami

Kauai Aadheenam

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

J. Landman Gay
On 12/4/11 8:09 PM, Sivakatirswami wrote:
> As anyone created a image cropping tool for LiveCode?

If you hold down the command key while resizing an image, it gets
cropped to the new size. There's no warning, it just happens.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

mwieder
Jacque-

Sunday, December 4, 2011, 7:37:07 PM, you wrote:

> If you hold down the command key while resizing an image, it gets
> cropped to the new size. There's no warning, it just happens.

!!! I'm constantly amazed by the things people around here know.
AFAICT this isn't documented anywhere other than a user-supplied note
in the dictionary under the crop command.

--
-Mark Wieder
 [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

J. Landman Gay
On 12/4/11 10:16 PM, Mark Wieder wrote:

> Jacque-
>
> Sunday, December 4, 2011, 7:37:07 PM, you wrote:
>
>> If you hold down the command key while resizing an image, it gets
>> cropped to the new size. There's no warning, it just happens.
>
> !!! I'm constantly amazed by the things people around here know.
> AFAICT this isn't documented anywhere other than a user-supplied note
> in the dictionary under the crop command.
>

I mostly remember it because I was so pleased when it was added to the
engine, and I use it periodically. Holding the Shift key down will
resize while maintaining the image ratio too. So a quick way to resize
and permanently set imagedata is to shift-drag to the size you want,
then command-jiggle a corner handle by one pixel and back. That way you
don't have to mess with "set the imagedata of img 1 to the imagedata of
img 1" in the message box.

But that may not be what's wanted here. I suspect a cropping tool would
use real pixel values, and a resizeable graphic to serve as a cropping
frame. I haven't written one of those but maybe someone else has.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Alejandro Tejada
In reply to this post by Sivakatirswami
Some years ago, I created this stack:
Mask bitmap 02
http://andregarzia.on-rev.com/alejandro/stacks/mask_bitmap02.zip

This version included the option to crop
the image while masking.

Just notice:

1) vector graphics used to crop and mask
the bitmap image should be "aliased". This means that
you had to deselect the box named "Antialiased" in
their properties.

2) The bitmap image should be completely visible in
the card. If the image is bigger than the card, then
the script of this palette will not work as expected.

I am sure that Wilhelm Sanke have worked extensively
on this same topic and the code that you need is
in one of his stacks.

Al
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Richard Gaskin
In reply to this post by J. Landman Gay
Jacque wrote:

> On 12/4/11 8:09 PM, Sivakatirswami wrote:
>> As anyone created a image cropping tool for LiveCode?
>
> If you hold down the command key while resizing an image, it gets
> cropped to the new size. There's no warning, it just happens.

That's a frightening way to have users accidentally lose data.

Is there a property to turn that off, or can we trap for commandKeyDown
on mouseDown to override it?

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

xtalkprogrammer
Hi Richard,

I never accidentally lost my data that way. Did you?

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/1bq Start selling Color Converter today. 20% commission!

On 5 dec 2011, at 14:51, Richard Gaskin wrote:
>
> That's a frightening way to have users accidentally lose data.
>
> Is there a property to turn that off, or can we trap for commandKeyDown on mouseDown to override it?
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Richard Gaskin
Mark Schonewille wrote:

 > On 5 dec 2011, at 14:51, Richard Gaskin wrote:
 >>
 >> That's a frightening way to have users accidentally lose data.
 >>
 >> Is there a property to turn that off, or can we trap for
 >> commandKeyDown on mouseDown to override it?
 >
 > Hi Richard,
 >
 > I never accidentally lost my data that way. Did you?

LOL.  I haven't had such reports yet, but when delivering robust systems
we don't ship things with the potential for losing data in the hope that
the user simply won't perform the action that would cause such loss, but
aim a little higher to prevent the potential for loss altogether.

So the question seems relevant:  how can we turn off this behavior?

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Björnke von Gierke
uhm... don't enable the pointer tool? set the resizability to false? set the editable to false? Seriously, if you have a image editing app, then you might want to use a cached version of the image anyway, because of rotation and similar ways to lose image quality. This is such a non issue for 99% of the apps, and easy to solve for everyone else, i'm amazed that you even feel the need to ask this question like that.


On 5 Dec 2011, at 15:55, Richard Gaskin wrote:

> Mark Schonewille wrote:
>
> > On 5 dec 2011, at 14:51, Richard Gaskin wrote:
> >>
> >> That's a frightening way to have users accidentally lose data.
> >>
> >> Is there a property to turn that off, or can we trap for
> >> commandKeyDown on mouseDown to override it?
> >
> > Hi Richard,
> >
> > I never accidentally lost my data that way. Did you?
>
> LOL.  I haven't had such reports yet, but when delivering robust systems we don't ship things with the potential for losing data in the hope that the user simply won't perform the action that would cause such loss, but aim a little higher to prevent the potential for loss altogether.
>
> So the question seems relevant:  how can we turn off this behavior?
>
> --
> Richard Gaskin
> Fourth World
> LiveCode training and consulting: http://www.fourthworld.com
> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
> LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


--
Watch live presentations every Saturday:
http://livecode.tv

Use an alternative Dictionary viewer:
http://bjoernke.com/bvgdocu/

Chat with other RunRev developers:
http://bjoernke.com/chatrev/


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

xtalkprogrammer
In reply to this post by Richard Gaskin
Richard,

I see no reason to turn this feature off. I never give the users of my software access to the pointer tool, which means that can never lose data this way. Personally, I really appreciate this feature because it is a very easy way to crop images: no need to edit them in an external editor.

As long as LiveCode users don't report this as an actual problem, I'd say don't fix it if it works. I'd rather not request a new feature to optionally turn off image cropping. I'd rather wish RunRev to invest the money I pay for licenses on something really useful, such as truly native text objects.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/1bq Start selling Color Converter today. 20% commission!

On 5 dec 2011, at 15:55, Richard Gaskin wrote:
>
> LOL.  I haven't had such reports yet, but when delivering robust systems we don't ship things with the potential for losing data in the hope that the user simply won't perform the action that would cause such loss, but aim a little higher to prevent the potential for loss altogether.
>
> So the question seems relevant:  how can we turn off this behavior?


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Richard Gaskin
In reply to this post by Björnke von Gierke
Mark Schonewille wrote:

 > On 5 dec 2011, at 15:55, Richard Gaskin wrote:
 >>
 >> LOL.  I haven't had such reports yet, but when delivering robust
 >> systems we don't ship things with the potential for losing data in
 >> the hope that the user simply won't perform the action that would
 >> cause such loss, but aim a little higher to prevent the potential
 >> for loss altogether.
 >>
 >> So the question seems relevant:  how can we turn off this behavior?
 >
 > I see no reason to turn this feature off. I never give the users of
 > my software access to the pointer tool, which means that can never
 > lose data this way.

That seems to be the common workaround to dodgy pointer tool behaviors.
  Jan and Ken take that approach as well, writing hundreds of lines of
code to emulate the pointer tool because the pointer tool itself just
isn't as useful as SuperCard's implementation.


 > As long as LiveCode users don't report this as an actual problem, I'd
 > say don't fix it if it works. I'd rather not request a new feature to
 > optionally turn off image cropping. I'd rather wish RunRev to invest
 > the money I pay for licenses on something really useful, such as
 > truly native text objects.

Agreed.  Please note that I didn't make a feature request, just
wondering if one can trap existing messages/properties to prevent this
undocumented behavior.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

xtalkprogrammer
Richard,

You can set the cantSelect of objects to true. That should solve it in most cases, unless... you have a picture that needs to be selectable :-)

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/1bq Start selling Color Converter today. 20% commission!

On 5 dec 2011, at 16:53, Richard Gaskin wrote:

<snip>
>
> Agreed.  Please note that I didn't make a feature request, just wondering if one can trap existing messages/properties to prevent this undocumented behavior.



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

J. Landman Gay
In reply to this post by Richard Gaskin
On 12/5/11 7:51 AM, Richard Gaskin wrote:

> Jacque wrote:
>
>> On 12/4/11 8:09 PM, Sivakatirswami wrote:
>>> As anyone created a image cropping tool for LiveCode?
>>
>> If you hold down the command key while resizing an image, it gets
>> cropped to the new size. There's no warning, it just happens.
>
> That's a frightening way to have users accidentally lose data.
>
> Is there a property to turn that off, or can we trap for commandKeyDown
> on mouseDown to override it?

It's in the engine, it isn't a property, but it's been there for three
or four years and I think if it were an issue we'd have heard by now.
It's largely a developer thing, and very convenient. As others said, if
your app doesn't use the pointer tool then it's a non-issue. I suppose
you could trap mousemove and check if the command key is down and tool
is the pointer tool to avoid the problem.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Richard Gaskin
In reply to this post by xtalkprogrammer
Mark Schonewille wrote:

 > On 5 dec 2011, at 16:53, Richard Gaskin wrote:
 >> Agreed.  Please note that I didn't make a feature request, just
 >> wondering if one can trap existing messages/properties to prevent
 >> this undocumented behavior.
 >
 >
 > You can set the cantSelect of objects to true. That should solve
 > it in most cases, unless... you have a picture that needs to be
 > selectable :-)

Indeed, there's the rub. ;)

There are sometimes unexpected-but-fully-understandable side-effects
with using the cantSelect property, but very useful for certain things
like using a graphic at the back of a drawing group to catch
drag-and-drop messages.

Someday I'll get around to finishing my port of SuperCard's SampleDraw
example app in LC to illustrate this sort of thing.

While I occasionally complain about some of the nuances with the
differences between SC and LC pointer tool behaviors, in all fairness I
have to admit that having groups with the option of turning off their
selectGroupedControls, coupled with having a scrolling group that can
occupy only part of a window rather than require the whole window, makes
some aspects of creating custom drawing environments in LC much more
powerful than anything I've used before.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Richard Gaskin
In reply to this post by J. Landman Gay
Jacque -
> I suppose you could trap mousemove and check if the command key is
> down and tool is the pointer tool to avoid the problem.

Good suggestion.  Thanks.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

sanke
In reply to this post by Sivakatirswami

On Mon Dec 5, 2011, Alejandro Tejada capellan2000 at gmail.com wrote:


> Some years ago, I created this stack:
> Mask bitmap 02
> http://andregarzia.on-rev.com/alejandro/stacks/mask_bitmap02.zip
> (snip)
>  The bitmap image should be completely visible in
> the card. If the image is bigger than the card, then
> the script of this palette will not work as expected.
>
> I am sure that Wilhelm Sanke have worked extensively
> on this same topic and the code that you need is
> in one of his stacks.
>
> Al


What Alejandro had in mind was probably my (also old) stack "More about
Masks"

<http://www.sanke.org/Software/MoreAboutMasksRev3.zip>.

The stack was put together with the cooperation of Jim Hurley and Bernd
Niggemann. It explores and discusses in detail different approaches to
crop images.

On card 3 "mask images as selection tools" you may find what you need.
The source image can be any size, also bigger than the card.

There are 11 masks on that page (among them different ovals,
rounded-rect, triangle, semicircle, star etc.) which can be resized in
any direction and put anywhere on the image.-

I have got another stack "Photo Patchworks", which is however not yet
publicly released and has some different features:

- you choose one of the masks, which you can place on the image and resize
- you select a transparency mode for the edges of the selection (if
intended for seamless blending)
- then you select a resizing mode (enlarge, no change, shrink) for the
selected patch and the rate of resizing
- after that you move the produced new part of the image to the location
on the image where you want to embed it
- finally you set the blendlevel for the image part to be embedded.
- And more, after all that you are asked if you intend to use the
cropped part of the image to be placed another time at a different spot
on the image.

The cropped patch can be also placed on a another image and the patches
itself can be flipped, rotated, and modified in still other ways.

As an example for the possibilities of the stack I had produced sort of
a caricature out of an image of G.W. Bush (two/three years ago?). The
image is still there on my website, but it is only accessible if you
know the exact URL.
However, some of the members of this list had felt offended then (my
thinking had been that Bush as a public figure could be modified in such
a way as it is usually the practice in newspapers and other media), so
you can assume that this was one the reasons to not release the stack,
because I did not want to interfere with U.S.-politics.

If, however, someone has the urgent need to produce caricatures of  
Tea-Party members or - maybe less likely - of candidates of the other
grand party, let me know that off-list.

The Photo Patchworks stack is compatible with any party.

Regards,

Wilhelm Sanke

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Chipp Walters
In reply to this post by Richard Gaskin
I think the issue isn't really whether or not someone will accidently use a
feature, but more along the lines of having the engine assume behaviors we
don't know of, or can't override in some way or another.

My friend and fellow LC'er, Jerry Daniels, is now working in RB. He needs
to as it has an embedded browser object which 'just works.' Discussions
with him over the experience is most interesting. RB forces certain ways of
working-- and doesn't 'allow' one to roll their own controls without
significant outside development-- something which LC has been able to do
for years.

I appreciate the basic nature of the engine and don't have a problem
building tools to allow one to crop or resize images rather than have it
embedded. As Jan and Ken do, I typically write my own using browse mode-- a
bit more difficult, but there you have complete control.

Sivakatirswami, I'll take a peek and see what crop code I may have lying
around. Most of it is embedded in much larger image editing types of
handlers.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Alejandro Tejada
Hi All,

Reading about masking and cropping images,
How both actions differs from importing an
snapshot of an area?

Thanks in advance!

Al
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Francis Nugent Dixon
In reply to this post by Sivakatirswami
Hi from Beautiful Brittany,

Alejandro wrote

> Some years ago, I created this stack:
> Mask bitmap 02

> http://andregarzia.on-rev.com/alejandro/stacks/mask_bitmap02.zip

Great Stuff ! Thanks a million !

-Francis

"Nothing should ever be done for the first time !"

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Image Cropping Tool for Livecode

Sivakatirswami
In reply to this post by J. Landman Gay
On 12/4/11 8:09 PM, Sivakatirswami wrote:
>> As anyone created a image cropping tool for LiveCode?
> On 12/4/11 5:37 PM, J. Landman Gay wrote:
> If you hold down the command key while resizing an image, it gets
> cropped to the new size. There's no warning, it just happens.

Yes, I am familiar with this option, but it has the very problem that
Richard points out: it is destructive.

Yes, of course we can, as Bjoerkne points out, have an undo... but this
again is not useful.

If you have a piece of portrait art/photo that you want to crop out a
rectangular section for using in a horizontal ratio slideshow, you are
making aesthetic "guesses" before the final crop and need the able to
drag out the area, make it bigger, move it etc.  It's a problem if the
actual image data is being "wiped out" as you drag into the image, you
want to be able to drag back out and get back your pixels. But as we
know, those pixels are gone. It would force the user to undo the entire
crop on every attempt to view a cropping option.   Way too user unfriendly.

i.e. you don't want your crop frame-rect-select tool to be actually
wiping out pixels until you click "OK" or "Crop" or "Do it!"




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode