• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set photometricInterpretation property while storing TIFF using JAI?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am converting JPG Grey Sale image in to bilevel image and saving in TIFF format with Group IV compression.

When I view the output TIFF, some applications displaying it properly and some others by inverting the image.

After a long time, I found that photometricInterpretation property is used to control this property of White_on_Black or Black_on_White in TIFF files.

In web I have found that, if we use IndexColorModel, then there is no problem. But, I am not using it and I don't know how to convert from RenderedOp's color model into IndexColorModel. Did anybody know it?

Is there any other way to set the PHOTOMETRICINTERPRETATION property ?

Any solution or suggestions are welcome...
 
Baskaran Kandhasamy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its Windows applications bug :

http://www.data-tech.com/help/imnet/DTI.ImageMan.Codecs~DTI.ImageMan.Codecs.TifEncoder~PhotometricInterpretation.html
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you desire to change photometricintepretation property programmatically.

If so, in my experience I was trying all sorts of ways to change this property - a) set extrafields on parameter (TIFFField) b) customized ColorModel, SampleModel, etc. c) creating own TIFFImageWriter. None of these worked for me.

The only thing that changed this property from MinIsBlack to MinIsWhite was to use the JAI.create("invert"...) command.

This is the method I used returning an inverted BufferedImage. You can change this to return an object less memory intensive.

private BufferedImage invertImage(String fileName) {
RenderedOp src = JAI.create("fileload", fileName);
RenderedOp op1 = JAI.create("invert", src);
return op1.getAsBufferedImage();
}

Hope this helps.
 
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic