Closed KyleMaas closed 1 year ago
I'll see if I can do something with GenericImage[View]
but rust is being a bit difficult about passing traits in generic structs.
That'd be awesome. I tried my hand at making my a builder but am still not familiar enough with Rust to be successful at it.
I have implemented a change for this that would allow you to call decoder.decode(&original_image.view(x, y, w, h).to_image());
. Could you please have a look to see if it works? :)
I think decoder.decode(&*original_image.view(x, y, w, h));
would also work though I personally prefer the first one.
Also to avoid version conflicts, it is now required to use image
version 0.24
or newer.
That does seem to function as expected. Thanks!
The documentation says to keep the source image size small, but the source images I have are huge. So I tried slicing them up using
DynamicImage::view()
. However, this results in a type ofSubImage<&DynamicImage>
, which supports theGenericImage
trait and thus I think it supports everything bardecoder needs. But I can't seem to find an efficient way to coerce this into something that bardecoder will work on. I've resorted to essentially this:...which seems like a really silly thing to have to do. Is there a better way to do this?