My app currently gets a picture from the camera or library and puts it into one large image area and two thumbnails, all on different cards. I do this by first putting it into a variable and then putting that variable into the images.
Now I want to crop a picture before placing it, and as I found out via a previous post, it seems it is only possible to access a cropped image via its imageData property. In other words you can't "put" it. You have to set the imageData of the target to the imageArea of the source. However, using imageData does not work when the image areas are different (as implied in the dictionary). Something appears in the target images but it is totally garbled.
So, is there any way I can crop a picture and put it into image areas of different sizes?
TIA
Don
Cropping and imageData woes
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Cropping and imageData woes
Hi Don,

Do this instead, I do this for years:
Import a snapshot of the image area you need*** and use that new (not cropped, but correct size anyway
) and FRESH image for any further action!
The user will not be able to tell the difference!
*** import snapshot from rect (the rect of grc "your reference object here") of img "the newly imported one"
You may want to set the topleft of your image to 0,0 so you can easily calculate the area "to be cropped".
Why struggle with a problem if you can avoid it
Best
Klaus
yes, do not use the CROP commandSo, is there any way I can crop a picture and put it into image areas of different sizes?

Do this instead, I do this for years:
Import a snapshot of the image area you need*** and use that new (not cropped, but correct size anyway

The user will not be able to tell the difference!
*** import snapshot from rect (the rect of grc "your reference object here") of img "the newly imported one"
You may want to set the topleft of your image to 0,0 so you can easily calculate the area "to be cropped".
Why struggle with a problem if you can avoid it

Best
Klaus
Re: Cropping and imageData woes
Hi Don,
Look at the stack in attachment (cd script)
Best regards
Jean-Marc
Look at the stack in attachment (cd script)
Best regards
Jean-Marc
- Attachments
-
- stOpenAndCrop.livecode.zip
- (1.35 KiB) Downloaded 307 times
https://alternatic.ch
Re: Cropping and imageData woes
Thats a cool stack...
Re: Cropping and imageData woes
Thanks guys
Klaus, your simple solution is all I need and will do the job nicely. I was not aware of the snapshot command.
Jean-Marc, your elegant script is great, but more than I need for this task.
Cheers
Don
Klaus, your simple solution is all I need and will do the job nicely. I was not aware of the snapshot command.
Jean-Marc, your elegant script is great, but more than I need for this task.
Cheers
Don