Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nlinside
Copy link

Second commit fixes usage of an ImageTypeSpecifier associated with a sample of 1x1 pixel.
Test coverage OK.

@aaime aaime requested a review from Copilot March 17, 2025 15:14
Copy link

@Copilot Copilot AI left a 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);
Copy link
Preview

Copilot AI Mar 17, 2025

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.

Suggested change
final ImageTypeSpecifier imageTypeSpecifier = new ImageTypeSpecifier(image);
final ImageTypeSpecifier imageTypeSpecifier = ImageTypeSpecifier.createFromRenderedImage(image);

Copilot uses AI. Check for mistakes.

Copy link
Member

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.

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.

2 participants