Subscribe Bookmark RSS Feed

Anyone have a handy example of the img<<Crop() function being used?

cnbremer

Community Trekker

Joined:

Apr 11, 2016

Been trying so many different things.... I have a bunch of images that I want to load with JSL, but I really only need the square of 200 x 200 pixels in the top-left corner.  I tried looking up examples of the Crop() function, but haven't had any success. Can anyone give me a nice 1-liner of how to get the top-left 200 x 200 pixels of an image using this feature?

Thank you!

2 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

Did you see the example in 'Help > Scripting Index' (search for 'crop')?

Craige_Hales

Staff

Joined:

Mar 21, 2013

Part of another project that needed to trim 3 pixels all around...

    img = ( report(gb)[framebox( 1 )] )<<getimage;

    fullsize = img<<size;

    // crop the 3 pixel border and the border line.  A little trial-and-error...

    img<<crop( left(3), top(3), right(fullsize[1]-3), bottom(fullsize[2]-3));

Craige