Skip to content

Incorrect XMLDoc of APNG #2988

Description

@Poker-sang

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

4.0

Other ImageSharp packages and versions

no

Environment (Operating system, version and so on)

no

.NET Framework version

no

Description

The FrameDelay for APNG should be measured in seconds. XMLdoc incorrectly states it as 1/100th of a second.

No logical errors apart from the documentation.

/// <summary>
/// Gets or sets the frame delay for animated images.
/// If not 0, when utilized in Png animation, this field specifies the number of hundredths (1/100) of a second to
/// wait before continuing with the processing of the Data Stream.
/// The clock starts ticking immediately after the graphic is rendered.
/// </summary>
public Rational FrameDelay { get; set; } = new(0);

Steps to Reproduce

no

Images

No response

Activity

  1. JimBobSquarePants commented on Sep 20, 2025

    @JimBobSquarePants
    Member

    The spec says 1/100 seconds

    https://www.w3.org/TR/png/#fcTL-chunk

  2. Poker-sang commented on Sep 20, 2025

    @Poker-sang
    ContributorAuthor

    It said

    display the current frame, in seconds

    and

    If the denominator is 0, it is to be treated as if it were 100 (that is, delay_num then specifies 1/100ths of a second)

  3. Poker-sang commented on Sep 20, 2025

    @Poker-sang
    ContributorAuthor

    If the document is correct, then these are wrong.

    FrameDelay = new Rational(metadata.Duration.TotalMilliseconds / 1000),

    Duration = TimeSpan.FromMilliseconds(delay * 1000),

  4. JimBobSquarePants commented on Sep 20, 2025

    @JimBobSquarePants
    Member

    You’re right, I misread the spec; the XML docs are wrong here. FrameDelay represents a fraction of a second (delay_num / delay_den), not centiseconds. I’ll get the docs fixed. Thanks for flagging it.

  5. added 2 commits that reference this issue on Oct 23, 2025
    370655b
    acb6d5a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions