camera.getImage
根據 URI 傳回完整大小或縮放過的圖片。輸入參數包括
解析度。這是唯一應傳回的指令,Content-Type: image/jpeg
。
所有其他指令都會傳回 Content-Type: application/json;charset=utf-8
。
這個指令已在 API 級別 2 中淘汰。
參數
- fileUri:目標檔案的 URI。製造商可決定是否使用
絕對或相對 URI用戶端可能會將此 ID 視為不透明 ID。
- maxSize: (選填) 所要求圖片的大小上限;
max(scaledimage_width, scaledimage_height) 的值。如果省略或更大的
maxSize
大於原尺寸圖片,則會傳回原尺寸的圖片。
結果
- content:圖片二進位資料,包括相對應的資料 (例如經過調整)
中繼資料。
錯誤
- missingParameter:未指定必要的
fileUri
。
- INVALIDParameterName:無法辨識輸入參數名稱。
- invalidParameterValue::系統會辨識輸入參數名稱,但其值
無效;例如
fileUri
值不存在、資料類型有誤。
或「maxSize
」的資料類型有誤。
指令 I/O |
指令輸入 |
{ "parameters": { "fileUri": "file URI", "maxSize": 400 } } |
指令輸出 |
Image binary data |
指令輸出 (錯誤) |
{ "error": { "code": "invalidParameterValue", "message": "Parameter fileUri doesn't exist." } } |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-21 (世界標準時間)。
[null,null,["上次更新時間:2024-08-21 (世界標準時間)。"],[[["Returns a full-size or scaled image based on its URI, with optional resizing using the `maxSize` parameter."],["This command is deprecated and was replaced in API level 2, primarily used for retrieving image data in JPEG format."],["Input requires a `fileUri` parameter, while `maxSize` is optional for scaling the output image."],["Output provides the image as binary data, including relevant metadata, or an error message in JSON format."],["Potential errors involve missing or invalid parameters, such as an incorrect `fileUri` or `maxSize` value."]]],["The command retrieves an image (full-size or scaled) via its URI, with `fileUri` being mandatory and `maxSize` (maximum dimension) being optional. If `maxSize` is omitted or exceeds the image's full size, the full-size image is provided. Output is image binary data, with `Content-Type: image/jpeg`. Errors include missing/invalid parameter or invalid value. It was deprecated in API level 2. Example input involves `fileUri` and `maxSize`. Example error is related to an invalid `fileUri`.\n"]]