Anyone have example code for creating banners from an image?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am
Location: Gulf Breeze, Florida

Anyone have example code for creating banners from an image?

Post by keithglong » Thu Feb 16, 2017 5:33 pm

Hi All,

I am about to start working on some code to create image banners (i.e., rectangle image bars) from selected images. If anyone has done this before and perhaps has some sample code they would be willing to share, then that would be awesome. (Before rolling my own, I figured it might be a good thing to check.) Thanks; I really appreciate it.

Sincerely,

Keith "Boo" Long
Gulf Breeze, Florida

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4000
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Anyone have example code for creating banners from an im

Post by bn » Thu Feb 16, 2017 7:39 pm

Hi Keith,

good to see you.

What do you mean by banner. Do you mean a cropped image to the dimensions of the banner or what?

Kind regards
Bernd

keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am
Location: Gulf Breeze, Florida

Re: Anyone have example code for creating banners from an im

Post by keithglong » Fri Feb 17, 2017 12:14 am

Hi Bernd,

Good to see you! Yeppers; I am referring to a banner image cropped from a standard photo. (I wrote my previous post kind of quickly and should have clarified it better.)

In particular, I hope to generate banner images that can be used on responsive Web pages, something like the following:

https://www.electrictoolbox.com/example ... anner.html

You are the guru, so I welcome your feedback. And as always, thank you. :-)

Sincerely,

Keith "Boo" Long
Gulf Breeze, Florida

P.S. Kelly and I enjoyed meeting you at the Conference in Edinburgh last summer.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4000
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Anyone have example code for creating banners from an im

Post by bn » Fri Feb 17, 2017 12:55 am

Hi Keith,

here is a little stack that shows how to use the crop command.

There is a transparent graphic that you drag over the top image and then click on button "cropImage" to crop the image, put it into the bottom image and restore the top image from a custom property of the card that contains the image. Change the graphic's size/proportions to what you want by resizing the graphic.

from the dictionary
Important: The crop command cannot be used on a referenced control|referenced image>. Doing so will cause an execution error.
If you have a referenced image you would have to use

Code: Select all

set the imageData of image "myImage" to the imageData of image "myImage"
this turns the referenced image into a local image that you can crop.

The stack is just bare bones but should get you started.

Kind regards
Bernd
Attachments
imageCropping.livecode.zip
(83.05 KiB) Downloaded 221 times

keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am
Location: Gulf Breeze, Florida

Re: Anyone have example code for creating banners from an im

Post by keithglong » Sat Feb 18, 2017 5:13 pm

Thanks Bernd.

Post Reply

Return to “Talking LiveCode”