Skip to main content

Reading TIFF Preview from EPS

2 replies [Last post]
gerdb
Offline
Joined: 2006-02-08

I'm trying to display a TIFF embedded in an EPS file. This works well for EPS created by OpenOffice, but for EPS created by Adobe InDesign the colors are screwed. The Image returned from ImageIO.read() has an imageType of 0 (custom) so it seems that the color model is not correctly identified by the reader. Tags are:

ImageWidth (1 Long): 595
ImageLength (1 Long): 841
BitsPerSample (1 Short): 8
Compression (1 Short): LZW
Photometric (1 Short): Palette
StripOffsets (16 Long): 8, 432, 856, 1280, 2964, 5832, 9236, 11472,...
SamplesPerPixel (1 Short): 2
RowsPerStrip (1 Long): 55
StripByteCounts (16 Long): 424, 424, 424, 1681, 2868, 3402, 2235, 424,...
XResolution (1 Rational): 72
YResolution (1 Rational): 72
PlanarConfig (1 Short): Contig
ColorMap (768 Short): 65535, 65021, 64507, 64250, 63736, 63222,...
ExtraSamples (1 Short): 2
346 (1 Short): 1

How can I apply correct colors to the image?

Also tried JAI.create(). Throws the following:
java.io.IOException: Unsupported combination of photometric interpretation, samples per pixel, and bit depth.

Message was edited by: gerdb

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23

So which code exactly are you using?

Also, is there an embedded ICC profile? Probably not as it's a palette image.

Brian

> I'm trying to display a TIFF embedded in an EPS file.
> This works well for EPS created by OpenOffice, but
> for EPS created by Adobe InDesign the colors are
> screwed. The Image returned from ImageIO.read() has
> an imageType of 0 (custom) so it seems that the color
> model is not correctly identified by the reader. Tags
> are:
>
> ImageWidth (1 Long): 595
> ImageLength (1 Long): 841
> BitsPerSample (1 Short): 8
> Compression (1 Short): LZW
> Photometric (1 Short): Palette
> StripOffsets (16 Long): 8, 432, 856, 1280, 2964,
> 5832, 9236, 11472,...
> SamplesPerPixel (1 Short): 2
> RowsPerStrip (1 Long): 55
> StripByteCounts (16 Long): 424, 424, 424, 1681, 2868,
> 3402, 2235, 424,...
> XResolution (1 Rational): 72
> YResolution (1 Rational): 72
> PlanarConfig (1 Short): Contig
> ColorMap (768 Short): 65535, 65021, 64507, 64250,
> 63736, 63222,...
> ExtraSamples (1 Short): 2
> 346 (1 Short): 1
>
> How can I apply correct colors to the image?
>
> Also tried JAI.create(). Throws the following:
> java.io.IOException: Unsupported combination of
> photometric interpretation, samples per pixel, and
> bit depth.
>
>
> age was edited by: gerdb

gerdb
Offline
Joined: 2006-02-08

Hi Brian,

Code is straightforward:

_bufferedImage = ImageIO.read(new MemoryCacheImageInputStream (new ByteArrayInputStream( bArray, _tiffInformationOffset, _tiffInformationLength )));

the resulting BufferedImage contains an ICC_ProfileGray, but the TIFF actually has colors.

Any ideas?

Gerd