crop image and store into new columnI wanted to crop images and store the cropped images in a new column.
My first approach was:
for each row (:new col = :old col << crop(...))
... but then I found @Craige_Hales post in the the community,
https://community.jmp.com/t5/Discussions/Crop-a-JPG-Image/m-p/442473/highlight/true#M69072
with the important information:

So, I tried this:
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
for each row (:pet = :picture );
wait(0);
for each row (:pet << Crop( Left( 5 ), Right( 10 ), Top( 6 ), Bottom( 100 ) ));
... without effect.
In the Scripting Index, I found:

Maybe use img as a temporary variable?
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
for each row( img= :picture;;img << Crop( Left( 5 ), Right( 70 ), Top( 30 ), Bottom( 50 ) );:pet = img)
and indeed:

But after clicking into the data table, I noticed that the input column was changed as well:

so, my final script was:
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
for each row( img= new image(:picture);img << Crop( Left( 5 ), Right( 70 ), Top( 30 ), Bottom( 50 ) );:pet = img)
- use new image() to create a new image
- resize this image
- store it in the new column
Automation and ScriptingRe: crop image and store into new columnUnfortunately, with my actual data set, just some of the images got cropped.
The easy explanation: I filled the image column via copy / paste from a Powerpoint presentation.
All the images had the same aspect ratio, therefore they had the same size in the JMP data grid - but they did not have the same actual size! And crop just works if the pixel values in the arguments are smaller than the actual size of the image.
Much easier to detect, when you use images with different aspect ratios ( trying to create a demo case for a community post ).

Open( "$SAMPLE_DATA/SAS Offices.jmp" );
New Column( "cropped", Expression);
for each row( img= new image(:Photo);
{w, h} = img << Get Size;
img << Crop( Left( 10 ), Right( 800 ), Top( 10 ), Bottom( 70 ) );:cropped = img)
so, my final script was:
Open( "$SAMPLE_DATA/SAS Offices.jmp" );
New Column( "cropped", Expression );
For Each Row(
try(img = New Image( :Photo );
{w, h} = img << Get Size;
target = 500;
img << scale( 500 / w );
{w, h} = img << Get Size;
img << Crop( Left( Round( w / 3 ) ), Right( Round( w / 3 * 2 ) ), Top( Round( h / 10 ) ), Bottom( Round( h / 5 ) ) );
:cropped = img;)
);
Try? -> just in case one of the images is missing.
Re: crop image and store into new columnThis is not difficult.
I think the difficult part is: making the background of one picture transparent and superimposing it on other pictures.
JSL does not have the function of making the background of pictures transparent.
It can only be achieved with the assistance of other software
Re: crop image and store into new columnrun program(executable("I:\00\FastStoneIV\magick.exe"),options({目||" -fill none -fuzz 0% -draw \!"color 92,30 floodfill\!" "||标}));
