Allow larger images if intentional
- Dominant language
- Swift
- Stars
- 4.2k
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
First, thanks for this very cool library!
My site needs to have thumbnails slightly larger than 100x100, like 120 or so. I'd like to have the option of using those, rather than generating a 100x100 image just to get the thumbhash.
My proposal is to change
```js
export function rgbaToThumbHash(w, h, rgba) {
// Encoding an image larger than 100x100 is slow with no benefit
if (w > 100 || h > 100) throw new Error(`${w}x${h} doesn't fit in 100x100`)
```
to
```js
export function rgbaToThumbHash(w, h, rgba, maxWidth=100, maxHeight=100) {
// Encoding an image larger than 100x100 is slow with no benefit, but may be useful if larger thumbnail images already exist.
if (w > maxWidth || h > maxHeight) throw new Error(`${w}x${h} doesn't fit in ${maxWidth}x{$maxHeight`)
```
Thank you for your consideration. By doing this, other implementations who are mirroring your code exactly can also implement it, e.g.
https://github.com/SRWieZ/thumbhash/issues/16#issuecomment-2662747835
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.