-
Notifications
You must be signed in to change notification settings - Fork 87
Issue#217 : problem using replacePixels method in TiffImageWriter when BigTiff is turned on #319
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
base: master
Are you sure you want to change the base?
Conversation
6148dd8
to
3a4b141
Compare
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.
Pull Request Overview
This PR addresses Issue#217 by correcting the behavior of the replacePixels method when BigTIFF mode is enabled. Key changes include adding new tests for both standard and BigTIFF cases, updating TIFFImageWriter to handle long offsets when BigTIFF is on, and ensuring TIFFIFD initialization accommodates the BigTIFF mode.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
plugin/tiff/src/test/java/it/geosolutions/imageio/tiff/TIFFWriteTest.java | Added tests for replacePixels and BigTIFF, with a potential inconsistency in ImageTypeSpecifier usage. |
plugin/tiff/src/main/java/it/geosolutions/imageioimpl/plugins/tiff/TIFFImageWriter.java | Updated tile offset writes to use long values when BigTIFF is enabled. |
plugin/tiff/src/main/java/it/geosolutions/imageioimpl/plugins/tiff/TIFFIFD.java | Modified initialization calls to pass the isBTIFF flag consistently. |
writer.setOutput(new FileImageOutputStream(outputFile)); | ||
|
||
final IIOMetadata streamMetadata = writer.getDefaultStreamMetadata(writeParam); | ||
final ImageTypeSpecifier imageTypeSpecifier = new ImageTypeSpecifier(image); |
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.
To ensure consistency and compatibility, use ImageTypeSpecifier.createFromRenderedImage(image) instead of invoking a constructor that may not behave as expected.
final ImageTypeSpecifier imageTypeSpecifier = new ImageTypeSpecifier(image); | |
final ImageTypeSpecifier imageTypeSpecifier = ImageTypeSpecifier.createFromRenderedImage(image); |
Copilot uses AI. Check for mistakes.
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.
Not a bad idea, the static method has dedicated paths for BufferedImage.
Second commit fixes usage of an ImageTypeSpecifier associated with a sample of 1x1 pixel.
Test coverage OK.