-
-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support frames metadata for Identify #2363
Support frames metadata for Identify #2363
Conversation
I’m sorry I’m late. @JimBobSquarePants I make without a global change of API, affecting only tiff metadata. At the moment, it is relevant only for tiff images. There is a way to add frames metadata into |
/// <value> | ||
/// The frames. | ||
/// </value> | ||
public IReadOnlyList<TiffFrameMetadata> Frames { get; set; } = Array.Empty<TiffFrameMetadata>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at how this is done with our Gif format you will see that the individual frame metadata is not a property of the main image one.
They're stored in a dictionary within individual ImageFrameMetadata
instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized what you mean by this.
I've pulled your code down and will work on a refactor to add the info to ImageInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pulled your code down and will work on a refactor to add the info to
ImageInfo
yes, this way looks more mature
@IldarKhayrutdinov I've updated your PR to add support for Gif also. Thanks for making a start on this, it made the feature much, much easier to implement! |
/// </summary> | ||
/// <param name="minCodeSize">Minimum code size of the data.</param> | ||
/// <param name="length">The resulting index table length.</param> | ||
public void SkipIndices(int minCodeSize, int length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gif doesn't tell you in advance the length of the combined LZW segment blocks. You have to read each one which must be decoded to read the next one.
// Interpret the code | ||
if (code > availableCode || code == endCode) | ||
{ | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This break here is the killer. A lot of properties we require for each loop follow.
/// <summary> | ||
/// Extension methods for <see cref="ImageFrameCollection{TPixel}"/>. | ||
/// </summary> | ||
public static class ImageFrameCollectionExtensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required because ImageFrameCollection<TPixel>
implements both IEnumerable<ImageFrame>
via inheritance and IEnumerable<ImageFrame<TPixel>>
. You have to awkwardly cast to use Select
and Where
etc.
Select
can easily be pollyfilled but an attempt to polyfill Where
or other members of System.Linq
will clash to it's easier to add a single AsEnumerable<TPixel>
method which can then be chained against for the System.Linq
methods.
I don't have time, thanks for finishing! |
/// <summary> | ||
/// 32 bits per pixel. One byte for each color channel. | ||
/// </summary> | ||
Bit32 = 32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added value for 32 bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ace thanks!
I've also added Bit64
and wired the encoder to default to Bit32
if that is given.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go!
Prerequisites
Description
Fixes for #2286
TiffMetadata
forIdentify
.InkSet
property toTiffFrameMetadata
, for identification of CMYK images.TiffMetadata
./cc @brianpopow
Update.
This PR has been expanded to add a new
IReadOnlyList<ImageFrameMetadata> FrameMetadataCollection
toImageInfo
and updated the gif decoder to also populate this property.