-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up HEIC plate extraction by using sharp
to convert to JPEG
#266
base: main
Are you sure you want to change the base?
Conversation
…nalpr This adds about 6 seconds of latency since `heic-convert` is written in JS, but it's better than nothing. Maybe I can get `sharp` working at some point. Fixes #263
This drops the latency from 6 seconds down to 1. However, it requires libheif and libvips to be installed, so I need to figure out how to do that on Heroku before this can be merged. On MacOS, this made it work (see lovell/sharp#2004 (comment)): ``` brew install libheif brew install libvips yarn remove sharp && yarn add sharp ``` Fixes #265: > See #264: > > > This adds about 6 seconds of latency since `heic-convert` is written in > > JS, but it's better than nothing. Maybe I can get `sharp` working at > > some point. > > Fixes #263: > > > Here's a test image [share.icloud.com/photos/0-5_Dy6WhkGw_7G-mlzadci-w#New_York](https://share.icloud.com/photos/0-5_Dy6WhkGw_7G-mlzadci-w#New_York) > > > I suspect openalpr doesn't support HEIC, and we might need to convert to JPG on the server before sending to openalpr, see [lovell/sharp#2004](lovell/sharp#2004) > > > If we can't get sharp working, try [npmjs.com/package/heic-convert](https://www.npmjs.com/package/heic-convert)
this would fix #271 EDIT: confirmed this reduces memory usage:
|
Looks like https://heictojpg.com/ can also convert while preserving EXIF metadata: |
mm, still no good:
|
I kicked off the review app build manually at https://dashboard.heroku.com/pipelines/cbc31c26-1c82-4965-91c0-8e311d3fa64b/app-setup/00ef2335-f0e6-4746-ba1e-95c2cfeca261, but it failed:
|
different error this time, I think this is the relevant part:
here's the whole thing
|
It seems like it's "working" on JPEGs and messing things up
EDIT: probably just a local thing, see next comment Hmm, got some errors locally when trying to submit a HEIC file I made by using https://convertio.co/jpg-heic/ on this file:
|
Ok, I'm guessing the above error is because I haven't set up VIPS on my local machine. I tried the same file on the review app, and got this in the heroku logs:
potentially related: lovell/sharp#1359 |
I remembered that
|
Another possibility is to have the browser do the conversion:
|
still-failing review app build log is at https://dashboard.heroku.com/pipelines/cbc31c26-1c82-4965-91c0-8e311d3fa64b/app-setup/daa7d8f0-5c15-406d-8b31-f23075dbfcbd |
Fresh review app failure: https://dashboard.heroku.com/pipelines/cbc31c26-1c82-4965-91c0-8e311d3fa64b/app-setup/21b8b308-0a2d-4c6b-9243-e42302fc25fb
|
This drops the extra latency from 6 seconds down to 1. However, it requires
libheif and libvips to be installed, so I need to figure out how to do
that on Heroku before this can be merged. On MacOS, this made it work
(see lovell/sharp#2004 (comment)):
Perhaps https://github.com/brandoncc/heroku-buildpack-vips, see also https://gist.github.com/bigtiger/be41fffcd103d7e98c5fe4fdff0af3f9
Fixes #265: