Cropping a referenced image

Klaus major-k klaus at major-k.de
Tue Aug 14 11:03:39 EDT 2018


Hi Swami,

> Am 14.08.2018 um 16:55 schrieb Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com>:
> 
> [sending this again, because it was rolled in another thread/conversation by the mail list}
> 
> #test
> 
> on mouseup
> put the long id of img "thumbTemplate" into pImage
> put the loc of pImage into pLocation
> set the filename of pImage to "https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg"<https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg><https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg><https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg>
> --set the filename of pImage to "https://i.ytimg.com/vi/KO3l3-4pFyo/hqdefault.jpg"<https://i.ytimg.com/vi/KO3l3-4pFyo/hqdefault.jpg><https://i.ytimg.com/vi/KO3l3-4pFyo/hqdefault.jpg><https://i.ytimg.com/vi/KO3l3-4pFyo/hqdefault.jpg>
> set the loc of pImage to pLocation
> 
> end mouseup
> 
> USE CASE:
> 1) eliminate top and bottom letter boxing on YouTube thumbnails. Easy done on web with CSS, not easy in LC
> 2) They provide a 4x3 by ratio
> 3) But when you post an HD video, thumbnail is 16x9, letterbox, top and bottom (45 pix of the hqdefault.jpg).
> 4) All youTube video channel thumbnails are letterboxed -- we don't 4X3 videos, ever...
> 6) "crop" command does on work with referenced images.
> 7) Look for a simple method that in the data grid takes up very little CPU time.
> 8) options
>     a) seems like I could make a mask on top the image to eliminate the letterbox.
>     b) other options?
> 9) we could go to the trouble to down load the thumb and crop and store them in /documents (mobile app); but there's no point: the user *has* to have a internet connection to use this module to view YouTube; and the call to https://i.ytimg.com is very fast, so why bother?
> 
> Spotify does a similar thing: it has a generic icon until the album cover is loaded.
> 
> Any ideas?  Meanwhile I'll explored masking.

can't you use a button, set its icon to your image(s) and then just "crop" the button?
Know what I mean?
...
set the width of btn "el croppo" to the width of img pImage
## Or use formattedwidth...

set the height of btn "el croppo" to round(the width of img pImage/16*9)
...

> BR

Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list