1# Rust Image Release Notes 2 3Rust image aims to be a pure-Rust implementation of various popular image formats. Accompanying reading/write support, rust image provides basic imaging processing function. See `README.md` for further details. 4 5## Known issues 6 - Images with *n* bit/channel (*n ≠ 8*) are not well supported but basic 7 support for 16-bit is available and implemented for PNG. 8 - Not all Interlaced (progressive) or animated images are well supported. 9 - The color space information of pixels is not clearly communicated. 10 11## Changes 12 13### Version 0.23.14 14 15- Unified gif blending in different decode methods, fixing out-of-bounds checks 16 in a number of weirdly positioned frames. 17- Hardened TGA decoder against a number of malicious inputs. 18- Fix forward incompatible usage of the panic macro. 19- Fix load_rect for gif reaching `unreachable!()` code. 20 21- Added `ExtendedColorType::A8`. 22- Allow TGA to load alpha-only images. 23- Optimized load_rect to avoid unnecessary seeks. 24 25### Version 0.23.13 26 27- Fix an inconsistency in supported formats of different methods for encoding 28 an image. 29- Fix `thumbnail` choosing an empty image. It now always prefer non-empty image 30 dimensions. 31- Fix integer overflow in calculating requires bytes for decoded image buffers 32 for farbfeld, hdr, and pnm decoders. These will now error early. 33- Fix a panic decoding certain `jpeg` image without frames or meta data. 34- Optimized the `jpeg` encoder. 35- Optimized `GenericImage::copy_from` default impl in various cases. 36 37- Add `avif` decoders. You must enable it explicitly and it is not covered by 38 our usual MSRV policy of Rust 1.34. Instead, only latest stable is supported. 39- Add `ImageFormat::{can_read, can_write}` 40- Add `Frame::buffer_mut` 41- Add speed and quality options on `avif` encoder. 42- Add speed parameter to `gif` encoder. 43- Expose control over sequence repeat to the `gif` encoder. 44- Add `{contrast,brighten,huerotate}_in_place` functions in imageproc. 45 46- Relax `Default` impl of `ImageBuffer`, removing the bound on the color type. 47- Derive Debug, Hash, PartialEq, Eq for DynamicImage 48 49### Version 0.23.12 50 51- Fix a soundness issue affecting the impls of `Pixel::from_slice_mut`. This 52 would previously reborrow the mutable input reference as a shared one but 53 then proceed to construct the mutable result reference from it. While UB 54 according to Rust's memory model, we're fairly certain that no miscompilation 55 can happen with the LLVM codegen in practice. 56 See 5cbe1e6767d11aff3f14c7ad69a06b04e8d583c7 for more details. 57- Fix `imageops::blur` panicking when `sigma = 0.0`. It now defaults to `1.0` 58 as all negative values. 59- Fix re-exporting `png::{CompressionType, FilterType}` to maintain SemVer 60 compatibility with the `0.23` releases. 61 62- Add `ImageFormat::from_extension` 63- Add copyless DynamicImage to byte slice/vec conversion. 64- Add bit-depth specific `into_` and `to_` DynamicImage conversion methods. 65 66 67### Version 0.23.11 68 69- The `NeuQuant` implementation is now supplied by `color_quant`. Use of the 70 type defined by this library is discouraged. 71- The `jpeg` decoder can now downscale images that are decoded by 1,2,4,8. 72- Optimized the jpeg encoding ~5-15%. 73- Deprecated the `clamp` function. Use `num-traits` instead. 74- The ICO decoder now accepts an empty mask. 75- Fixed an overflow in ICO mask decoding potentially leading to panic. 76- Added `ImageOutputFormat` for `AVIF` 77- Updated `tiff` to `0.6` with lzw performance improvements. 78 79### Version 0.23.10 80 81- Added AVIF encoding capabilities using the `ravif` crate. Please note that 82 the feature targets the latest stable compiler and is not enabled by default. 83- Added `ImageBuffer::as_raw` to inspect the underlying container. 84- Updated `gif` to `0.11` with large performance improvements. 85 86### Version 0.23.9 87 88- Introduced correctly capitalized aliases for some scream case types 89- Introduced `imageops::{vertical_gradient, horizontal_gradient}` for writing 90 simple color gradients into an image. 91- Sped up methods iterating over `Pixels`, `PixelsMut`, etc. by using exact 92 chunks internally. This should auto-vectorize `ImageBuffer::from_pixel`. 93- Adjusted `Clone` impls of iterators to not require a bound on the pixel. 94- Add `Debug` impls for iterators where the pixel's channel implements it. 95- Add comparison impls for `FilterType` 96 97### Version 0.23.8 98 99- `flat::Error` now implements the standard `Error` trait 100- The type parameter of `Map` has been relaxed to `?Sized` 101- Added the `imageops::tile` function that repeats one image across another 102 103### Version 0.23.7 104 105- Iterators over immutable pixels of `ImageBuffer` can now be cloned 106- Added a `tga` encoder 107- Added `ColorMap::lookup`, an optional reversal of the map 108- The `EncodableLayout` trait is now exported 109 110### Version 0.23.6 111 112- Added `png::ApngDecoder`, an adapter decoding the animation in an APNG. 113- Fixed a bug in `jpeg` encoding that would darken output colors. 114- Added a utility constructor `FlatSamples::with_monocolor`. 115- Added `ImageBuffer::as_flat_samples_mut` which is a mutable variant of the 116 existing ffi-helper `ImageBuffer::as_flat_samples`. 117 118### Version 0.23.5 119 120- The `png` encoder now allows configuring compression and filter type. The 121 output is not part of stability guarantees, see its documentation. 122- The `jpeg` encoder now accepts any implementor of `GenericImageView`. This 123 allows images that are only partially present in memory to be encoded. 124- `ImageBuffer` now derives `Hash`, `PartialEq`, `Eq`. 125- The `Pixels`/`PixelsMut` iterator no longer yields out-of-bounds pixels when 126 the underlying buffer is larger than required. 127- The `pbm` decoder correctly decodes ascii data again, fixing a regression 128 where it would use the sample value `1` as white instead of `255`. 129- Fix encoding of RGBA data in `gif` frames. 130- Constructing a `Rows`/`RowsMut` iterator no longer panics when the image has 131 a width or height of `0`. 132 133### Version 0.23.4 134 135- Improved the performance of decoding animated gifs 136- Added `crop_imm` which functions like `crop` but on a shared reference 137- The gif `DisposalMethod::Any` is treated as `Keep`, consistent with browsers 138- Most errors no longer allocate a string, instead implement Display. 139- Add some implementations of `Error::source` 140 141### Version 0.23.3 142 143- Added `ColorType::has_alpha` to facilitate lossless conversion 144- Recognize extended WebP formats for decoding 145- Added decoding and encoding for the `farbfeld` format 146- Export named iterator types created from various `ImageBuffer` methods 147- Error in jpeg encoder for images larger than 65536 pixels, fixes panic 148 149### Version 0.23.2 150 151- The dependency on `jpeg-decoder` now reflects minimum requirements. 152 153### Version 0.23.1 154 155- Fix cmyk_to_rgb (jpeg) causing off by one rounding errors. 156- A number of performance improvements for jpeg (encode and decode), bmp, vp8 157- Added more details to errors for many formats 158 159### Version 0.23.0 160 161This major release intends to improve the interface with regards to handling of 162color format data and errors for both decoding and encoding. This necessitated 163many breaking changes anyways so it was used to improve the compliance to the 164interface guidelines such as outstanding renaming. 165 166It is not yet perfect with regards to color spaces but it was designed mainly 167as an improvement over the current interface with regards to in-memory color 168formats, first. We'll get to color spaces in a later major version. 169 170- Heavily reworked `ColorType`: 171 - This type is now used for denoting formats for which we support operations 172 on buffers in these memory representations. Particularly, all channels in 173 pixel types are assumed to be an integer number of bytes (In terms of the 174 Rust type system, these are `Sized` and one can crate slices of channel 175 values). 176 - An `ExtendedColorType` is used to express more generic color formats for 177 which the library has limited support but can be converted/scaled/mapped 178 into a `ColorType` buffer. This operation might be fallible but, for 179 example, includes sources with 1/2/4-bit components. 180 - Both types are non-exhaustive to add more formats in a minor release. 181 - A work-in-progress (#1085) will further separate the color model from the 182 specific channel instantiation, e.g. both `8-bit RGB` and `16-bit BGR` 183 are instantiations of `RGB` color model. 184- Heavily rework `ImageError`: 185 - The top-level enum type now serves to differentiate cause with multiple 186 opaque representations for the actual error. These are no longer simple 187 Strings but contains useful types. Third-party decoders that have no 188 variant in `ImageFormat` have also been considered. 189 - Support for `Error::source` that can be downcast to an error from a 190 matching version of the underlying decoders. Note that the version is not 191 part of the stable interface guarantees, this should not be relied upon 192 for correctness and only be used as an optimization. 193 - Added image format indications to errors. 194 - The error values produced by decoder will be upgraded incrementally. See 195 something that still produces plain old String messages? Feel free to 196 send a PR. 197- Reworked the `ImageDecoder` trait: 198 - `read_image` takes an output buffer argument instead of allocating all 199 memory on its own. 200 - The return type of `dimensions` now aligns with `GenericImage` sizes. 201 - The `colortype` method was renamed to `color_type` for conformity. 202- The enums `ColorType`, `DynamicImage`, `imageops::FilterType`, `ImageFormat` 203 no longer re-export all of their variants in the top-level of the crate. This 204 removes the growing pollution in the documentation and usage. You can still 205 insert the equivalent statement on your own: 206 `use image::ImageFormat::{self, *};` 207- The result of `encode` operations is now uniformly an `ImageResult<()>`. 208- Removed public converters from some `tiff`, `png`, `gif`, `jpeg` types, 209 mainly such as error conversion. This allows upgrading the dependency across 210 major versions without a major release in `image` itself. 211- On that note, the public interface of `gif` encoder no longer takes a 212 `gif::Frame` but rather deals with `image::Frame` only. If you require to 213 specify the disposal method, transparency, etc. then you may want to wait 214 with upgrading but (see next change). 215- The `gif` encoder now errors on invalid dimensions or unsupported color 216 formats. It would previously silently reinterpret bytes as RGB/RGBA. 217- The capitalization of `ImageFormat` and other enum variants has been 218 adjusted to adhere to the API guidelines. These variants are now spelled 219 `Gif`, `Png`, etc. The same change has been made to the name of types such as 220 `HDRDecoder`. 221- The `Progress` type has finally received public accessor method. Strange that 222 no one reported them missing. 223- Introduced `PixelDensity` and `PixelDensityUnit` to store DPI information in 224 formats that support encoding this form of meta data (e.g. in `jpeg`). 225 226### Version 0.22.5 227 228- Added `GenericImage::copy_within`, specialized for `ImageBuffer` 229- Fixed decoding of interlaced `gif` files 230- Prepare for future compatibility of array `IntoIterator` in example code 231 232### Version 0.22.4 233 234- Added in-place variants for flip and rotate operations. 235- The bmp encoder now checks if dimensions are valid for the format. It would 236 previously write a subset or panic. 237- Removed deprecated implementations of `Error::description` 238- Added `DynamicImage::into_*` which convert without an additional allocation. 239- The PNG encoder errors on unsupported color types where it had previously 240 silently swapped color channels. 241- Enabled saving images as `gif` with `save_buffer`. 242 243### Version 0.22.3 244 245- Added a new module `io` containing a configurable `Reader`. It can replace 246 the bunch of free functions: `image::{load_*, open, image_dimensions}` while 247 enabling new combinations such as `open` but with format deduced from content 248 instead of file path. 249- Fixed `const_err` lint in the macro expanded implementations of `Pixel`. This 250 can only affect your crate if `image` is used as a path dependency. 251 252### Version 0.22.2 253 254- Undeprecate `unsafe` trait accessors. Further evaluation showed that their 255 deprecation should be delayed until trait `impl` specialization is available. 256- Fixed magic bytes used to detect `tiff` images. 257- Added `DynamicImage::from_decoder`. 258- Fixed a bug in the `PNGReader` that caused an infinite loop. 259- Added `ColorType::{bits_per_pixel, num_components}`. 260- Added `ImageFormat::from_path`, same format deduction as the `open` method. 261- Fixed a panic in the gif decoder. 262- Aligned background color handling of `gif` to web browser implementations. 263- Fixed handling of partial frames in animated `gif`. 264- Removed unused direct `lzw` dependency, an indirect dependency in `tiff`. 265 266### Version 0.22.1 267 268- Fixed build without no features enabled 269 270### Version 0.22 271 272- The required Rust version is now `1.34.2`. 273- Note the website and blog: [image-rs.org][1] and [blog.image-rs.org][2] 274- `PixelMut` now only on `ImageBuffer` and removed from `GenericImage` 275 interface. Prefer iterating manually in the generic case. 276- Replaced an unsafe interface in the hdr decoder with a safe variant. 277- Support loading 2-bit BMP images 278- Add method to save an `ImageBuffer`/`DynamicImage` with specified format 279- Update tiff to `0.3` with a writer 280- Update png to `0.15`, fixes reading of interlaced sub-byte pixels 281- Always use custom struct for `ImageDecoder::Reader` 282- Added `apply_without_alpha` and `map_without_alpha` to `Pixel` trait 283- Pixel information now with associated constants instead of static methods 284- Changed color structs to tuple types with single component. Improves 285 ergonomics of destructuring assignment and construction. 286- Add lifetime parameter on `ImageDecoder` trait. 287- Remove unecessary `'static` bounds on affine operations 288- Add function to retrieve image dimensions without loading full image 289- Allow different image types in overlay and replace 290- Iterators over rows of `ImageBuffer`, mutable variants 291 292[1]: https://www.image-rs.org 293[2]: https://blog.image-rs.org 294 295### Version 0.21.2 296 297- Fixed a variety of crashes and opaque errors in webp 298- Updated the png limits to be less restrictive 299- Reworked even more `unsafe` operations into safe alternatives 300- Derived Debug on FilterType and Deref on Pixel 301- Removed a restriction on DXT to always require power of two dimensions 302- Change the encoding of RGBA in bmp using bitfields 303- Corrected various urls 304 305### Version 0.21.1 306 307- A fairly important bugfix backport 308- Fixed a potentially memory safety issue in the hdr and tiff decoders, see #885 309- See [the full advisory](docs/2019-04-23-memory-unsafety.md) for an analysis 310- Fixes `ImageBuffer` index calculation for very, very large images 311- Fix some crashes while parsing specific incomplete pnm images 312- Added comprehensive fuzzing for the pam image types 313 314### Version 0.21 315 316- Updated README to use `GenericImageView` 317- Removed outdated version number from CHANGES 318- Compiles now with wasm-unknown-emscripten target 319- Restructured `ImageDecoder` trait 320- Updated README with a more colorful example for the Julia fractal 321- Use Rust 1.24.1 as minimum supported version 322- Support for loading GIF frames one at a time with `animation::Frames` 323- The TGA decoder now recognizes 32 bpp as RGBA(8) 324- Fixed `to_bgra` document comment 325- Added release test script 326- Removed unsafe code blocks several places 327- Fixed overlay overflow bug issues with documented proofs 328 329### Version 0.20 330 331- Clippy lint pass 332- Updated num-rational dependency 333- Added BGRA and BGR color types 334- Improved performance of image resizing 335- Improved PBM decoding 336- PNM P4 decoding now returns bits instead of bytes 337- Fixed move of overlapping buffers in BMP decoder 338- Fixed some document comments 339- `GenericImage` and `GenericImageView` is now object-safe 340- Moved TIFF code to its own library 341- Fixed README examples 342- Fixed ordering of interpolated parameters in TIFF decode error string 343- Thumbnail now handles upscaling 344- GIF encoding for multiple frames 345- Improved subimages API 346- Cargo fmt fixes 347 348### Version 0.19 349 350- Fixed panic when blending with alpha zero. 351- Made `save` consistent. 352- Consistent size calculation. 353- Fixed bug in `apply_with_alpha`. 354- Implemented `TGADecoder::read_scanline`. 355- Use deprecated attribute for `pixels_mut`. 356- Fixed bug in JPEG grayscale encoding. 357- Fixed multi image TIFF. 358- PNM encoder. 359- Added `#[derive(Hash)]` for `ColorType`. 360- Use `num-derive` for `#[derive(FromPrimitive)]`. 361- Added `into_frames` implementation for GIF. 362- Made rayon an optional dependency. 363- Fixed issue where resizing image did not give exact width/height. 364- Improved downscale. 365- Added a way to expose options when saving files. 366- Fixed some compiler warnings. 367- Switched to lzw crate instead of using built-in version. 368- Added `ExactSizeIterator` implementations to buffer structs. 369- Added `resize_to_fill` method. 370- DXT encoding support. 371- Applied clippy suggestions. 372 373### Version 0.4 374 - Various improvements. 375 - Additional supported image formats (BMP and ICO). 376 - GIF and PNG codec moved into separate crates. 377 378### Version 0.3 379 - Replace `std::old_io` with `std::io`. 380 381### Version 0.2 382 - Support for interlaced PNG images. 383 - Writing support for GIF images (full color and paletted). 384 - Color quantizer that converts 32bit images to paletted including the alpha channel. 385 - Initial support for reading TGA images. 386 - Reading support for TIFF images (packbits and FAX compression not supported). 387 - Various bug fixes and improvements. 388 389### Version 0.1 390- Initial release 391- Basic reading support for png, jpeg, gif, ppm and webp. 392- Basic writing support for png and jpeg. 393- A collection of basic imaging processing function like `blur` or `invert` 394