milch / LRExportHEIC

MIT License
39 stars 4 forks source link

Adds Option to Limit File Size #3

Closed YoungCatChen closed 2 years ago

YoungCatChen commented 2 years ago

(So I was able to work on the limit-file-size option, ref: https://github.com/milch/LRExportHEIC/issues/2#issue-1120319459 , and I managed to get a working version!)

This PR adds the option to limit resulting file size.

The Lua entry point is changed to pass settings to the underlying Swift command-line tool (CLI). The CLI's flags are changed, and the logic of finding best quality is added to a new file WriteSizeLimitedHEIF.swift. Its binary search algorithm is in a separate file QualitySearch.swift, which is guarded by a unit test on QualitySearchTests.swift.

Please feel free to let me know if you have any comments. Thanks in advance for reviewing!

milch commented 2 years ago

Thanks for your contribution 🙏🏼