[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"marketplace-site-banners":3,"@directus-labs\u002Fai-focal-point-detection-operation":9},[4],{"id":5,"icon":6,"content":7,"link":8,"include_paths":6,"exclude_paths":6},"5cf2f5f6-aecf-4395-8c23-69de326fdf02",null,"Directus V12 is here","https:\u002F\u002Fdirectus.com\u002Fresources\u002Fv12-built-for-the-whole-team",{"name":10,"description":11,"verified":12,"id":13,"readme":14,"type":15,"last_updated":16,"host_version":17,"downloads":18,"total_downloads":21,"sandbox":86,"license":87,"publisher":88,"versions":97,"formatted_name":161,"formatted_readme":162,"formatted_description":11,"featured_image":163,"images":164,"recent_downloads_7_days":33,"recent_downloads_30_days":166},"@directus-labs\u002Fai-focal-point-detection-operation","Use OpenAI Vision models to find an image's focal points.",false,"ef89be76-255d-428b-9ab3-1fe38b4e71f4","# AI Focal Point Detection Operation\n\nDetermine an image focal point, powered by [OpenAI](https:\u002F\u002Fplatform.openai.com\u002F).\n\n![The AI Focal Point Detection operation, showing an Openai API Key field and a File URL field.](https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-focal-point-detection-operation\u002Fdocs\u002Foptions.png)\n\nThis operation contains two required configuration options - an [OpenAI API Key](https:\u002F\u002Fplatform.openai.com), and a link to a file. It returns a JSON object containing the focal point coordinates and the reason these were chosen.\n\n![The output showing a JSON object containing a a flocal_point_x, focal_point_y, and reason parameter.](https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-focal-point-detection-operation\u002Fdocs\u002Foutput.png)\n\nYou can use the operation to then save the result to a file.\n\n## Output\n\nThis operation outputs a JSON object with the following structure:\n\n```json\n{\n    \"focal_point_x\": 328,\n    \"focal_point_y\": 250,\n    \"reason\": \"Centered between the two people on the beach, who are the main subjects of the image.\"\n}\n```\n\nUse an Update Data operation to store the `focal_point_x` and `focal_point_y` values on the file object.\n\n## Flow Setup\n\n### Automatically Detect Focal Points For New Files\n\nCreate a Flow with an **Event Hook** action trigger and a scope of `files.upload`. Use the AI Focal Point detection operation, setting the File URL to `https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $trigger.key }}`, being sure to provide your specific Directus Project URL.\n\nThis will work if your file is public, but if it isn't, you can append `?access_token=token` to the File URL, replacing the value with a valid user token that has access to the file.\n\nThis operation will trigger on every new file upload, regardless of location or filetype. You may wish to add a conditional step between the trigger and detection operation. The following condition rule will check that the file is an image:\n\n```json\n{\n    \"$trigger\": {\n        \"payload\": {\n            \"type\": {\n                \"_contains\": \"image\"\n            }\n        }\n    }\n}\n```\n\n### Detect On-Demand\n\nCreate a Flow with a **Manual** trigger and select a collection with a file field, which should contain an image file. Set the Location to Item Page Only. To receive the file ID create a **Read Data** operation for the same collection, setting IDs to `{{ $trigger.body.keys[0] }}`.\n\nUse the AI Focal Point Detection operation, setting the File URL to `https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $last.file_field_name }}`, being sure to provide your specific Directus Project URL and file field name.\n","operation","2024-12-18T11:07:04.612Z","^10.10.0",[19,22,25,27,29,31,34,37,39,41,43,45,47,50,52,55,57,60,62,64,66,68,70,72,74,76,78,80,82,84],{"date":20,"count":21},"2026-06-17",0,{"date":23,"count":24},"2026-06-18",6,{"date":26,"count":21},"2026-06-19",{"date":28,"count":21},"2026-06-20",{"date":30,"count":21},"2026-06-21",{"date":32,"count":33},"2026-06-22",2,{"date":35,"count":36},"2026-06-23",3,{"date":38,"count":21},"2026-06-24",{"date":40,"count":33},"2026-06-25",{"date":42,"count":21},"2026-06-26",{"date":44,"count":21},"2026-06-27",{"date":46,"count":36},"2026-06-28",{"date":48,"count":49},"2026-06-29",1,{"date":51,"count":21},"2026-06-30",{"date":53,"count":54},"2026-07-01",10,{"date":56,"count":49},"2026-07-02",{"date":58,"count":59},"2026-07-03",4,{"date":61,"count":33},"2026-07-04",{"date":63,"count":49},"2026-07-05",{"date":65,"count":49},"2026-07-06",{"date":67,"count":21},"2026-07-07",{"date":69,"count":49},"2026-07-08",{"date":71,"count":59},"2026-07-09",{"date":73,"count":36},"2026-07-10",{"date":75,"count":21},"2026-07-11",{"date":77,"count":21},"2026-07-12",{"date":79,"count":49},"2026-07-13",{"date":81,"count":21},"2026-07-14",{"date":83,"count":21},"2026-07-15",{"date":85,"count":49},"2026-07-16",true,"MIT",{"username":89,"verified":86,"id":90,"github_username":89,"github_name":91,"github_blog":92,"github_bio":93,"github_location":94,"github_company":95,"github_avatar_url":96},"ukmadlz","74ce2e77-733a-4e9a-b96d-93bf6264f622","Mike Elsmore","http:\u002F\u002Felsmore.me","(╯°□°）╯︵ TABLEFLIP","UK","@DigitalSpeed","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F804683?v=4",[98,116,131,146],{"version":99,"package":13,"publisher":100,"type":15,"host_version":17,"publish_date":101,"verified":12,"id":102,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":59,"unpacked_size":103,"sandbox":86,"sandbox_requested_scopes":104,"license":87,"bundled":111,"maintainers":112},"1.0.2","8486d50d-a6bc-45c6-8627-60f3c144732c","2024-08-12T12:08:21.577Z","3f4250ab-4de9-48ad-82e9-602c1570f261",5301,{"request":105,"log":110},{"urls":106,"methods":108},[107],"https:\u002F\u002Fapi.openai.com\u002Fv1\u002Fchat\u002F**",[109],"POST",{},[],[113,114,115],11119,11120,11121,{"version":117,"package":13,"publisher":100,"type":15,"host_version":17,"publish_date":118,"verified":12,"id":119,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":59,"unpacked_size":120,"sandbox":86,"sandbox_requested_scopes":121,"license":87,"bundled":126,"maintainers":127},"1.0.0","2024-03-15T12:53:19.309Z","5ef64322-b747-4637-b7aa-854ed2f650ba",5780,{"request":122,"log":125},{"urls":123,"methods":124},[107],[109],{},[],[128,129,130],10565,10566,10567,{"version":132,"package":13,"publisher":90,"type":15,"host_version":17,"publish_date":16,"verified":12,"id":133,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":59,"unpacked_size":134,"sandbox":86,"sandbox_requested_scopes":135,"license":87,"bundled":140,"maintainers":141},"1.0.3","839fd63e-a813-49d3-9d4d-7f45bf6937ce",5436,{"request":136,"log":139},{"urls":137,"methods":138},[107],[109],{},[],[142,143,144,145],11731,11732,11733,11734,{"version":147,"package":13,"publisher":100,"type":15,"host_version":17,"publish_date":148,"verified":12,"id":149,"url_repository":6,"url_homepage":6,"url_bugs":6,"file_count":59,"unpacked_size":150,"sandbox":86,"sandbox_requested_scopes":151,"license":87,"bundled":156,"maintainers":157},"1.0.1","2024-03-15T13:49:27.656Z","8925642e-fc9e-46c6-bb57-bedeecee5bbb",5316,{"request":152,"log":155},{"urls":153,"methods":154},[107],[109],{},[],[158,159,160],10568,10569,10570,"AI Focal Point Detection Operation","\u003Ch1>AI Focal Point Detection Operation\u003C\u002Fh1>\n\u003Cp>Determine an image focal point, powered by \u003Ca href=\"https:\u002F\u002Fplatform.openai.com\u002F\">OpenAI\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-focal-point-detection-operation\u002Fdocs\u002Foptions.png\" alt=\"The AI Focal Point Detection operation, showing an Openai API Key field and a File URL field.\">\u003C\u002Fp>\n\u003Cp>This operation contains two required configuration options - an \u003Ca href=\"https:\u002F\u002Fplatform.openai.com\">OpenAI API Key\u003C\u002Fa>, and a link to a file. It returns a JSON object containing the focal point coordinates and the reason these were chosen.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-focal-point-detection-operation\u002Fdocs\u002Foutput.png\" alt=\"The output showing a JSON object containing a a flocal_point_x, focal_point_y, and reason parameter.\">\u003C\u002Fp>\n\u003Cp>You can use the operation to then save the result to a file.\u003C\u002Fp>\n\u003Ch2>Output\u003C\u002Fh2>\n\u003Cp>This operation outputs a JSON object with the following structure:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-json\">{\n    \"focal_point_x\": 328,\n    \"focal_point_y\": 250,\n    \"reason\": \"Centered between the two people on the beach, who are the main subjects of the image.\"\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Use an Update Data operation to store the \u003Ccode>focal_point_x\u003C\u002Fcode> and \u003Ccode>focal_point_y\u003C\u002Fcode> values on the file object.\u003C\u002Fp>\n\u003Ch2>Flow Setup\u003C\u002Fh2>\n\u003Ch3>Automatically Detect Focal Points For New Files\u003C\u002Fh3>\n\u003Cp>Create a Flow with an \u003Cstrong>Event Hook\u003C\u002Fstrong> action trigger and a scope of \u003Ccode>files.upload\u003C\u002Fcode>. Use the AI Focal Point detection operation, setting the File URL to \u003Ccode>https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $trigger.key }}\u003C\u002Fcode>, being sure to provide your specific Directus Project URL.\u003C\u002Fp>\n\u003Cp>This will work if your file is public, but if it isn't, you can append \u003Ccode>?access_token=token\u003C\u002Fcode> to the File URL, replacing the value with a valid user token that has access to the file.\u003C\u002Fp>\n\u003Cp>This operation will trigger on every new file upload, regardless of location or filetype. You may wish to add a conditional step between the trigger and detection operation. The following condition rule will check that the file is an image:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-json\">{\n    \"$trigger\": {\n        \"payload\": {\n            \"type\": {\n                \"_contains\": \"image\"\n            }\n        }\n    }\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3>Detect On-Demand\u003C\u002Fh3>\n\u003Cp>Create a Flow with a \u003Cstrong>Manual\u003C\u002Fstrong> trigger and select a collection with a file field, which should contain an image file. Set the Location to Item Page Only. To receive the file ID create a \u003Cstrong>Read Data\u003C\u002Fstrong> operation for the same collection, setting IDs to \u003Ccode>{{ $trigger.body.keys[0] }}\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>Use the AI Focal Point Detection operation, setting the File URL to \u003Ccode>https:\u002F\u002Fyour-directus-project-url\u002Fassets\u002F{{ $last.file_field_name }}\u003C\u002Fcode>, being sure to provide your specific Directus Project URL and file field name.\u003C\u002Fp>\n","https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-focal-point-detection-operation\u002Fdocs\u002Foptions.png",[163,165],"https:\u002F\u002Fraw.githubusercontent.com\u002Fdirectus-labs\u002Fextensions\u002Fmain\u002Fpackages\u002Fai-focal-point-detection-operation\u002Fdocs\u002Foutput.png",40]