{ "name": "MicroEarn - Image Converter and Compressor", "nodes": [ { "id": "5664f627-f13d-4d91-8068-2a4c66aa161d", "name": "Setup and pricing", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -520, -180 ], "parameters": { "content": "## Image conversion with MicroEarn\nCreate an Apify Header Auth credential: Authorization = Bearer YOUR_APIFY_TOKEN. Restrict to api.apify.com and select it in both HTTP nodes. Never embed tokens.\n\nRun the included synthetic PNG or replace images with raw Base64 JPEG, PNG or WebP images (up to 10). Set outputFormat, quality and maxSide.\n\nTemplate is free; Actor usage may incur charges ($0.0008/image plus $0.0005 startup at standard memory). Sample limit: $0.05. Runs exceeding 60 seconds require polling. Review storage retention before uploading sensitive files.", "width": 440, "height": 520 } }, { "id": "381786a3-ec58-4ed2-a2c2-afa7b1fb7e65", "name": "Start conversion", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, -160 ], "parameters": { "content": "## Start and validate run\nLaunch the Actor with a synthetic PNG and check the run status before retrieving results.", "width": 680, "height": 300, "color": 7 } }, { "id": "1324a681-ff84-446a-839e-62fcbdc49154", "name": "Retrieve conversion", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 680, -160 ], "parameters": { "content": "## Retrieve and validate output\nRead OUTPUT from the run storage and verify successful image conversion.", "width": 440, "height": 300, "color": 7 } }, { "id": "7ff38bcb-5cdb-473a-bab4-a933d0e06bea", "name": "When Manually Triggered", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ 0, 0 ], "parameters": {} }, { "id": "077ca13b-9e43-4d70-bd2d-8f877886bbc8", "name": "Run Image Converter", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 240, 0 ], "parameters": { "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "method": "POST", "url": "https://api.apify.com/v2/acts/microearn~microearn-image-factory/runs", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "waitForFinish", "value": "60" }, { "name": "maxTotalChargeUsd", "value": "0.05" }, { "name": "memory", "value": "512" }, { "name": "timeout", "value": "120" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "{\"images\": [\"iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAIAAAAlV+npAAAAh0lEQVR4nO3QQQ3AIADAQMDSPOEJt7OwvsiSOwVN57PP4Jt1O+BPzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKzArMCswKXv2nAZayBDVdAAAAAElFTkSuQmCC\"], \"outputFormat\": \"webp\", \"quality\": 80, \"maxSide\": 50}", "options": { "timeout": 90000 } } }, { "id": "439845c9-6be2-4cf9-ac24-852d08d9c3aa", "name": "Check Image Run", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 480, 0 ], "parameters": { "jsCode": "const run = $input.first().json.data;\nif (!run || run.status !== 'SUCCEEDED' || !run.defaultKeyValueStoreId) throw new Error('Image run not completed successfully: ' + (run?.status ?? 'unknown'));\nreturn [{json:{storeId:run.defaultKeyValueStoreId}}];" } }, { "id": "e02c5299-22f5-4e02-98d0-f8352c891adf", "name": "Fetch Image Results", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 720, 0 ], "parameters": { "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "url": "={{ 'https://api.apify.com/v2/key-value-stores/' + $json.storeId + '/records/OUTPUT' }}", "options": { "timeout": 30000 } } }, { "id": "16d460fa-665e-4dc8-a950-53955e898bd3", "name": "Verify Image Output", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 960, 0 ], "parameters": { "jsCode": "const result = $input.first().json;\nif (result.status !== 'ok' || !Number.isInteger(result.images_processed) || result.images_processed < 1) throw new Error('Image conversion failed or invalid output');\nreturn [{json:result}];" } } ], "connections": { "When Manually Triggered": { "main": [ [ { "node": "Run Image Converter", "type": "main", "index": 0 } ] ] }, "Run Image Converter": { "main": [ [ { "node": "Check Image Run", "type": "main", "index": 0 } ] ] }, "Check Image Run": { "main": [ [ { "node": "Fetch Image Results", "type": "main", "index": 0 } ] ] }, "Fetch Image Results": { "main": [ [ { "node": "Verify Image Output", "type": "main", "index": 0 } ] ] } }, "active": false, "pinData": {}, "settings": { "executionOrder": "v1" } }