Comments (6)
I'm interested in similar things for image editing in Loupe. I'm also willing to try contributing to it mid-term.
In my head, that needs a decoder that keeps all original image data around and returns a ReEncoder
. If, for example, an image is just cropped, the ReEncoder
would just be updated with the new image information. All data like ICC profile, CICP, EXIF, XMP, HEIF metadata, etc, would just remain untouched.
Additional to updating the image data, functions for updating that information as well, could be added. Updating fields inside the EXIF information should be left to an external library (it's a rabbit hole in itself.)
Trying to transfer all metadata explicitly sounds like an unrealistic task and not what one wants for image editing.
Of course, in practice, it's probably not that easy. The encoder for the format might not support the original storage format or other things. However, each encoder should have a pretty good idea of which chunks or segments it needs to write for image data so that it can add/replace them.
As recent bugs have shown, cropping an image and replacing the image data in place is apparently pretty easy to get wrong as well 🙃
In theory, the things I have described here should already be possible to do by combining img-parts and image-rs. However, having this feature in image-rs would be a much better thing.
from image.
We really don't have much support for dealing with EXIF metadata today. It would be a bit of work, but if this is something you'd like to look at improving, I'd suggest starting with the individual image format crates. So png
or tiff
or whatever.
from image.
Hi, I've recently fixed a bug in our app caused by image-rs
ignoring orientation in metadata. Also lost metadata was a surprise as well.
I've used the Rust crate kamadak-exif to read and filter Exif fields and then img-parts to write the Exif data.
Also I had to fix the image orientation before processing the image by image-rs
and then remove the orientation field from Exif. You can rewrite this C# snippet to Rust to fix the orientation.
Just my tips / experience :)
from image.
If you want to either (a) retain a specific sort of metadata like EXIF or ICC profile, or (b) retain all the metadata chunks from a file but accept that you'll be unable to convert formats, then I think this might be feasible to implement.
However, if you want to load an arbitrary PNG/JPEG/TIFF/etc. file and save it as a different one of those formats with every bit of metadata intact, you are looking at a huge undertaking. Many chunks don't have equivalents across all the formats, and even the ones that do may frequently require parsing and re-encoding the metadata.
from image.
save it as a different one of those formats
Agreed, that's unrealistic and wasn't my intention. You would have to stick to the same format to ReEncode an image. What I meant with "storage format" in my original post is something like the original JPEG is progressive, but image-rs can only encode baseline.
from image.
In that case, the best starting point would probably be to look at adding re-encoding functionality to one/several of the format specific crates image uses and then go from there.
from image.
Related Issues (20)
- Certain JPEGs cause assertion failure in zune-jpeg HOT 6
- 10-bit avif support HOT 2
- How to set the DPI of an image before saving it? HOT 1
- DynamicImage.view().to_image() results in Rgba8 buffer even when source isn't HOT 2
- Moving `imageops` and similar functionality to the `imageprocs` crate HOT 8
- JpegEncoder is very slow! HOT 2
- Add missing map2/apply2 functions to `Pixel` trait HOT 4
- PBM encoder is incorrect for ASCII, aka PnmSubtype::Bitmap(SampleEncoding::Ascii) HOT 1
- Proposal: more aggressive feature flags HOT 4
- Version 0.26.x HOT 5
- Opening and saving an sRGB image yields different colors HOT 5
- PNG (and probably AVIF) encoding with compression too slow HOT 6
- Format error decoding Jpeg: invalid JPEG format: JPGn(7) marker found where not allowed HOT 5
- Add serde support for image::ImageFormat HOT 2
- JPEG decoding inconsistent with other (non-Rust libraries) HOT 1
- Invert Alpha method HOT 5
- Switch to the `rgb` crate `v0.9` pixel types and trait. HOT 5
- Format error decoding Png: Invalid PNG signature. When reading png with embedded color profile HOT 4
- Building with default features on macOS requires rustc v1.79 or newer. HOT 7
- Creating a new `PixelImage` type. HOT 6
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.