Summary: | Unable to export preview as jpeg from Lua script | ||
---|---|---|---|
Product: | Orthanc | Reporter: | Sébastien Jodogne <s.jodogne> |
Component: | Orthanc Core | Assignee: | Sébastien Jodogne <s.jodogne> |
Status: | RESOLVED FIXED | ||
Severity: | minor | ||
Priority: | --- | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All |
Description
Sébastien Jodogne
2020-06-29 15:14:29 CEST
[BitBucket user: Sébastien Jodogne] [BitBucket date: 2019-06-24.14:06:54] Fix issue #106 (Unable to export preview as jpeg from Lua script) → https://hg.orthanc-server.com/orthanc/changeset/dd1e68f2d0c0 [BitBucket user: Sébastien Jodogne] [BitBucket date: 2019-06-24.14:08:53] `RestApiGet()` now can be provided with HTTP headers. Full example: ```lua function Initialize() local instanceId= '19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5' local png = RestApiGet('/instances/' .. instanceId .. '/preview', true) print('PNG size: ' .. string.len(png)) local headers = {} headers['Accept']='image/jpeg' local jpeg = RestApiGet('/instances/' .. instanceId .. '/preview', true, headers) print('JPEG size (default quality = 90): ' .. string.len(jpeg)) local jpeg50 = RestApiGet('/instances/' .. instanceId .. '/preview?quality=50', true, headers) print('JPEG size (quality 50): ' .. string.len(jpeg50)) headers['Accept']='image/x-portable-arbitrarymap' local pam = RestApiGet('/instances/' .. instanceId .. '/preview', true, headers) print('PAM size (uncompressed): ' .. string.len(pam)) end ``` |