Comments (11)
Will take a crack at it.
from image.
The PNG encoder should support all the integer formats (and has generally been better optimized compared to the TIFF encoder). The magic bytes at the start of the file will indicate which format it is
from image.
PNG for integer images, TIFF for floating point, then.
from image.
A substantial portion of this crate is devoted to encoding and decoding image file formats. I don't quite understand the benefit of inventing our own bespoke image format to serialize and deserialize DynamicImage
s when users can instead use one of the standard formats
from image.
The encoding/decoding methods are not ubiquitous and require further setup of the encoders and decoders. Serialization and deserialization are not meant for transporting image data across different devices and architectures, instead for ease of programming where, e.g., I want to capture image data and create a DynamicImage
, serialize it, send it over IP to a client, and unpack it into a DynamicImage
, and continue processing it.
from image.
I suppose I should link this related PR which stalled out, but was trying to add uncompressed serialization/deserialization support.
If we do add serialization, I think it is very likely that people will use it to send images between different devices are architectures. But that's not necessarily a problem if we design it well. And there is a lot to be said for the convenience argument of not having to manually go through the process of encoding and decoding, particularly if the DynamicImage
is within a larger structure.
Perhaps the thing to do would be to lean on our existing codecs? Have the wire format actually look like DynamicImage(Vec<u8>)
and the blob of bytes be a PNG or TIFF encoded blob. That would likely get us better compression ratios and faster performance over using flate2 directly. And if we used standard image formats we wouldn't have to worry about versioning or mismatches between different image
releases
from image.
Using PNG/TIFF is fine as long as the data can be transferred without loss (including channel information etc). However, in my understanding, serialization-deserialization is opaque (correct me if I am wrong). As long as care is taken to account for multi-byte-endianness (which I do), I don't see why the system has to marry an image format.
from image.
Any way of serializing image data is essentially by definition an image format. The only question is whether it is a bespoke format that we've created ourselves or something standardized. Part of the benefit of picking a standard format is that we don't have to design one ourselves. But there's also benefits in terms of making sure that the format isn't accidentally changed between versions of this library (people may serialize with one version and deserialize with the next) and the higher level of testing and optimization we've already done for our existing formats.
from image.
I see how we can benefit by picking a standard format. As long as PNG (or some other, standard format) can accept all the variants of DynamicImage
and transfer them in a completely lossless manner, then standard format is definitely the way to go. But, I think, none of the encoders support F32 images (correct me if I am wrong). Hence, the 'simple' serialization-deserialization format where the data is compressed and encoded, with ancillary information (width, height, color type, byte endianness).
from image.
The TIFF format supports floating point. If the encoder doesn't currently allow it, it shouldn't be too much work to add
from image.
Adding 32F support was straightforward, but tiff encoder does not support gray images with alpha channel.
from image.
Related Issues (20)
- Panic when checking broken tiff file HOT 1
- Freeze when trying to open and save jpg and webp files HOT 3
- Random crashes when decoding exr file HOT 2
- `image` still depends on `jpeg-decoder` through the `tiff` crate
- `rayon` is included in the dependency tree even when the `rayon` feature is disabled when `ravif` feature is enabled HOT 1
- The documentation on `crop()` is confusing HOT 1
- Add in-place versions of all rotation operations HOT 1
- `DynamicImage::crop()` is slow because `to_image()` is slow HOT 1
- Cropping API doesn't check bounds, easy to misuse HOT 7
- EnumeratePixels and EnumerateRows should implement DoubleEndedIterator HOT 3
- Implement a `rows()` iterator on `SubImage` HOT 6
- how to convert a rgbaImage to opencv's Mat?
- Regression: Hot lib reload, unable to find __rust_alloc. HOT 6
- Increased generation loss in JPEG encoder HOT 1
- Broken link in docs HOT 2
- Should the next major release be 1.0? HOT 2
- Detect alpha on jpeg HOT 2
- Alternate versions of the crates which allow regular breaking changes HOT 7
- Animated WebP decoding error HOT 8
- “Corrupt RLE data” on simple BMP
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image.