camera.getImage
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
یک تصویر در اندازه کامل یا مقیاسبندی شده را با توجه به URI آن برمیگرداند. پارامترهای ورودی شامل وضوح است. این تنها دستوری است که باید برگردد، Content-Type: image/jpeg
. همه دستورات دیگر Content-Type: application/json;charset=utf-8
را برمی گرداند. این دستور در سطح 2 API منسوخ شد.
پارامترها
- fileUri: URI فایل مورد نظر. تولیدکنندگان تصمیم می گیرند که از URI های مطلق یا نسبی استفاده کنند. مشتریان ممکن است این را به عنوان یک شناسه غیر شفاف تلقی کنند.
- maxSize: (اختیاری) حداکثر اندازه تصویر درخواستی. حداکثر (عرض_تصویر، اندازه_ارتفاع). اگر
maxSize
حذف شود یا بزرگتر از تصویر با اندازه کامل باشد، تصویر در اندازه کامل برگردانده می شود.
نتایج
- محتوا: داده های باینری تصویر، از جمله ابرداده متناظر (به عنوان مثال، مقیاس شده) در سرصفحه تصویر.
خطاها
- 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."
}
} |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-11-09 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2024-11-09 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eReturns a full-size or scaled image based on its URI, with optional resizing using the \u003ccode\u003emaxSize\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eThis command is deprecated and was replaced in API level 2, primarily used for retrieving image data in JPEG format.\u003c/p\u003e\n"],["\u003cp\u003eInput requires a \u003ccode\u003efileUri\u003c/code\u003e parameter, while \u003ccode\u003emaxSize\u003c/code\u003e is optional for scaling the output image.\u003c/p\u003e\n"],["\u003cp\u003eOutput provides the image as binary data, including relevant metadata, or an error message in JSON format.\u003c/p\u003e\n"],["\u003cp\u003ePotential errors involve missing or invalid parameters, such as an incorrect \u003ccode\u003efileUri\u003c/code\u003e or \u003ccode\u003emaxSize\u003c/code\u003e value.\u003c/p\u003e\n"]]],["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"],null,["# camera.getImage\n\nReturns a full-size or scaled image given its URI. Input parameters include\nresolution. This is the only command that should return, `Content-Type: image/jpeg`.\nAll other commands return `Content-Type: application/json;charset=utf-8`.\n**This command was deprecated in API level 2.**\n\nParameters\n----------\n\n- **fileUri:** URI of the target file. Manufacturers decide whether to use absolute or relative URIs. Clients may treat this as an opaque identifier.\n- **maxSize:** (Optional) Maximum size of the requested image; max(scaledimage_width, scaledimage_height). If `maxSize` is omitted or larger than the full-size image, the full-size image is returned.\n\nResults\n-------\n\n- **content:** Image binary data, including corresponding (for example, scaled) metadata in image header.\n\nErrors\n------\n\n- **missingParameter:** The required `fileUri` is not specified.\n- **invalidParameterName:** An input parameter name is unrecognized.\n- **invalidParameterValue:** The input parameter name is recognized, but its value is invalid; for example, the `fileUri` value doesn't exist, its data type is incorrect, or `maxSize` has the wrong data type.\n\n| Command I/O ----------- ||\n|----------------------------|-------------------------------------------------------------------------------------------------------------|\n| **Command Input** | ```text { \"parameters\": { \"fileUri\": \"file URI\", \"maxSize\": 400 } } ``` |\n| **Command Output** | ```text Image binary data ``` |\n| **Command Output (Error)** | ```text { \"error\": { \"code\": \"invalidParameterValue\", \"message\": \"Parameter fileUri doesn't exist.\" } } ``` |"]]