* @return copied parameters.
*/
private ImageReadParam cloneImageReadParam(ImageReadParam param,
boolean copyTagSets) {
// Create a new TIFFImageReadParam.
TIFFImageReadParam newParam = new TIFFImageReadParam();
// Copy the basic settings.
newParam.setSourceSubsampling(param.getSourceXSubsampling(),
param.getSourceYSubsampling(),
param.getSubsamplingXOffset(),
param.getSubsamplingYOffset());
newParam.setSourceBands(param.getSourceBands());
newParam.setDestinationBands(param.getDestinationBands());
newParam.setDestinationOffset(param.getDestinationOffset());
// Set the decompressor and color converter.
if(param instanceof TIFFImageReadParam) {
// Copy the settings from the input parameter.
TIFFImageReadParam tparam = (TIFFImageReadParam)param;
newParam.setTIFFDecompressor(tparam.getTIFFDecompressor());
newParam.setColorConverter(tparam.getColorConverter());
if(copyTagSets) {
List tagSets = tparam.getAllowedTagSets();
if(tagSets != null) {
Iterator tagSetIter = tagSets.iterator();
if(tagSetIter != null) {
while(tagSetIter.hasNext()) {
TIFFTagSet tagSet = (TIFFTagSet)tagSetIter.next();