<jupyter_start><jupyter_text>Crop those bounding rect<jupyter_code>import os
import pathlib
import json
from PIL import Image
# Read training.json to artic
with open('training.json') as json_data:
    data = json.load(json_data)
    artic = data['Artic']

#define the path
inputDir = pathlib.Path('F:\\')
outputDir = pathlib.Path('E:\\noaa\\crop-img')
for i in range(0,len(artic)):
    currentFullFilename = artic[i]['filt_color']
    inputFile = os.path.join(inputDir, currentFullFilename)
    currentFilename = os.path.splitext(currentFullFilename)[0] + "_HOTSPOT_" + artic[i]['hotspot_id'] + ".JPG"
    outputFile = os.path.join(outputDir, currentFilename)
    img = Image.open(inputFile)

    x1 = int(artic[i]['thumb_left'])
    y1 = int(artic[i]['thumb_top'])
    x2 = int(artic[i]['thumb_right'])
    y2 = int(artic[i]['thumb_bottom'])
    area=(x1,y1,x2,y2)
    crop_img = img.crop(area)
    crop_img.save(outputFile)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1549738219895288, 'fraction_numerical': 0.010471204188481676, 'mean_word_length': 4.937888198757764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '250103', 'license': 'MIT', 'n_tokens_mistral': 359, 'n_tokens_neox': 351, 'n_words': 63, 'path': 'src/viewer/util/Crop Images.ipynb', 'repo_name': 'Bhaskers-Blu-Org2/arcticseals', 'size': '955'}