Skip to content

Conversation

@ikkyuland
Copy link
Member

@ikkyuland ikkyuland commented Jul 11, 2025

Title

DW-34 lazy load AnyBitmap & improve Tiff processing

Description

  • Lazy load image to ImageSharp obj (since it use a lot of memory)
  • Binary will always be the original bytes[] (except after SetPixel() which we need to re set Binary value)
  • Use less ImageSharp.CloneAs()
  • Use PNG encoder to load image that bigger than 1902 * 1080 (dynamic in .net 6) //slower than BMP which use a lot more memory
  • Always use BMP encoder
  • No longer resize all the Tiff frames
  • Load tiff as List
  • Use BitMiracle.LibTiff to save .tiff instead of ImageSharp
  • Fixes ImageSharp color casting
  • No breaking change 🤞
  • No new API
  • Cache Width Height BitsPerPixel value for faster operation

Fixes #(DW-34)

From This test
image

Screenshot 2025-07-15 100615 Screenshot 2025-07-15 100829

Type of change

Please select the relevant option by placing an 'x' inside the brackets, like this: [x].

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🏗️ Internal/structural update (non-breaking change that improves code quality, organization, or performance)
  • 📚 This change requires a documentation update
  • 🚀 DevOps build chain modification for release
  • 🤖 DevOps build chain modification for CI

How Has This Been Tested?

Describe the tests you ran to verify your changes. Provide instructions so others can reproduce the tests. Also, list any relevant details for your test configuration.

Checklist:

Please run through the checklist as much as possible and mark the items completed by placing an 'x' inside the brackets, like this: [x].

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have successfully run all unit tests on Windows
  • I have successfully run all unit tests on Linux

Additional Context

Add any other context, screenshots, or information about the pull request here.

@ikkyuland ikkyuland marked this pull request as draft July 14, 2025 03:27
@ikkyuland ikkyuland marked this pull request as ready for review August 4, 2025 07:53
Copy link
Member

@mee-ironsoftware mee-ironsoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my feedback.

Copy link
Member

@mee-ironsoftware mee-ironsoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another feedback for optimization loading Tiff image.

Copy link
Member

@mee-ironsoftware mee-ironsoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outstanding work! The implementations significantly improve IronSoftware.System.Drawing's performance, thread safety, and maintainability.

I have 2 minor suggestions below that are optional enhancements - you can safely ignore them and proceed with merge:

  1. Exception Types: Consider InvalidOperationException instead of generic Exception
  2. FrameCount Readability: Current pattern is clever, alternative shown if preferred

Copy link
Member

@mee-ironsoftware mee-ironsoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ikkyuland I just found 1 issue please check my feedback.

Copy link
Contributor

@first-ironsoftware first-ironsoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great 🎉

@first-ironsoftware first-ironsoftware merged commit 2733819 into develop Aug 19, 2025
9 checks passed
@first-ironsoftware first-ironsoftware deleted the DW-34-lazy-load-anybitmap branch August 19, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants