Skip to content

Regression in TIF image loading #2149

Description

@TonyValenti

Prerequisites

  • I have bought a Commercial License
  • 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

3.0.0-alpha.0.19

Other ImageSharp packages and versions

2.1.2

Environment (Operating system, version and so on)

Windows 11 x64

.NET Framework version

6.0.5

Description

@brianpopow recently made a number of performance enhancements to TIF images, however, I believe he introduced a regression that occurs when processing certain tiff files.

Steps to Reproduce

Run this with ImageSharp 2.1.2 and the PNG file looks identical to the TIF.
Run with the latest beta and the TIF shows duplicated, smudged content as shown here.

image

using SixLabors.ImageSharp;

namespace ConsoleApp59 {

    public static class Program {
        public static void Main(string[] args) {

            var FileIn = @"0009e03b.tif";

            var FileOut = @"OUTPUT.png";

            var Image = SixLabors.ImageSharp.Image.Load(FileIn);

            Image.SaveAsPng(FileOut);

        }
    
    }

}

Images

@brianpopow - I am not comfortable publicly sharing the source image at this time. Can you please email [email protected] and I will provide the image to you?

Activity

  1. brianpopow commented on Jun 10, 2022

    @brianpopow
    Collaborator

    The commit causing this seems to be: 57349fd

    Not sure why the tests did not catch this one.

  2. TonyValenti commented on Jun 10, 2022

    @TonyValenti
    Author

    @brianpopow Is it an easy fix? If so, can you let me know when you push the update? I'm working on a time-sensitive project.

  3. JimBobSquarePants commented on Jun 11, 2022

    @JimBobSquarePants
    Member

    I’ll create a PR later.

  4. brianpopow commented on Jun 11, 2022

    @brianpopow
    Collaborator

    I think we need to clear the destination for the decompressed data here to fix it:

  5. brianpopow commented on Jun 11, 2022

    @brianpopow
    Collaborator

    The issue only happens when there are multiple strips in the image. The current test images only have one strip.

    Here is a test image replicating the issue:
    Group4CompressionWithStrips.zip

    TIFF Directory at offset 0x1058 (4184)
      Image Width: 205 Image Length: 305
      Resolution: 96, 96 pixels/inch
      Bits/Sample: 1
      Compression Scheme: CCITT Group 4
      Photometric Interpretation: min-is-white
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 1
      Rows/Strip: 100
      Planar Configuration: single image plane
      Software: IrfanView
    
  6. brianpopow commented on Jun 12, 2022

    @brianpopow
    Collaborator

    I have opened a PR to fix this: #2150

  7. TonyValenti commented on Jun 12, 2022

    @TonyValenti
    Author

    Thank you so much!

    I'm not sure how imageSharp manages the PR > commit > beta build process but I'll check in on the MyGet page throughout the day and hopefully a new build will appear soon!

  8. brianpopow commented on Jun 12, 2022

    @brianpopow
    Collaborator

    I'm not sure how imageSharp manages the PR > commit > beta build process but I'll check in on the MyGet page throughout the day and hopefully a new build will appear soon!

    There will be a new MyGet beta version, once the PR is merged to the main branch.

  9. TonyValenti commented on Jun 12, 2022

    @TonyValenti
    Author

    Thanks! Do the PRs merge automatically or manually? I noticed that the PR says it is unable to merge.

  10. brianpopow commented on Jun 12, 2022

    @brianpopow
    Collaborator

    Thanks! Do the PRs merge automatically or manually? I noticed that the PR says it is unable to merge.

    Its manually, another one from the ImageSharp team needs to review the changes first.

  11. brianpopow commented on Jun 13, 2022

    @brianpopow
    Collaborator

    @TonyValenti there is now a alpha.0.20 version with the fix.

  12. TonyValenti commented on Jun 13, 2022

    @TonyValenti
    Author

    @brianpopow Thank you so much! I'm testing it now.

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