Open Bug 1615398 Opened 4 years ago Updated 2 years ago

Expose color profile used during decoding

Categories

(Core :: Graphics: ImageLib, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: aosmond, Assigned: aosmond)

References

(Blocks 1 open bug)

Details

We need to expose the color profile using during decoding somehow to a caller. This would be used to attach the ICC profile when re-encoding an image to another format (e.g. to a BMP on Windows, CGImage on Mac, etc).

Given the relative rarity of this (just clipboard really), I think a good approach is to add a new SurfaceFlag, EXPORT_ICC_PROFILE. This will cause a redecode since it won't match anything in the cache, but that will be true in general since we want to start using NO_COLORSPACE_CONVERSION / NO_PREMULTIPLY_ALPHA. If the new SurfaceFlag is set, we can use SourceSurface::AddUserData to hang a pointer to the ICC profile / metadata off it, which can be checked for in the encoder.

Assignee: nobody → aosmond

More generally, this should probably be something like EXPORT_IMAGE_METADATA. The encoders can do a better job knowing what relevant parameters were used during decoding with that data. By default they need to assume they are premultiplied, and possibly undo that effect in the encoder; if we supply all of these bits and bobs with the ICC profile, then the encoder can make a much more intelligent decision on how to proceed with the re-encoding. EXIF rotation data should also be supplied to allow fixing bug 1583309 without doing the rotation ourselves.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.