Hello,
I noticed some misleading documentation in the Image struct. The pixels field claims that there are 8 bits per channel; however, I do not believe this is the case. If we look at the implementation of Image::new, we see that the pixels field is constructed with DynamicImage::into_bytes. The implementation of into_bytes seems to just cast the pixel data to Vec<u8> without any pixel format conversions.
I suspect that this hasn't been caught, because most images are 8 bits per channel. However, it would be misleading for other pixel formats. I think the docs should be updated to remove the (8 bits per channel) part. I would appreciate a second look to make sure my logic here is correct.
Thanks!
Hello,
I noticed some misleading documentation in the Image struct. The
pixelsfield claims that there are8 bits per channel; however, I do not believe this is the case. If we look at the implementation of Image::new, we see that thepixelsfield is constructed with DynamicImage::into_bytes. The implementation ofinto_bytesseems to just cast the pixel data toVec<u8>without any pixel format conversions.I suspect that this hasn't been caught, because most images are 8 bits per channel. However, it would be misleading for other pixel formats. I think the docs should be updated to remove the
(8 bits per channel)part. I would appreciate a second look to make sure my logic here is correct.Thanks!