Bug 691489 - PDF 1.7 FTS: images incorrect
Summary: PDF 1.7 FTS: images incorrect
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Images (show other bugs)
Version: master
Hardware: PC All
: P1 normal
Assignee: Alex Cherepanov
URL:
Keywords:
: 691516 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-22 06:52 UTC by Marcos H. Woehrmann
Modified: 2011-10-02 02:35 UTC (History)
2 users (show)

See Also:
Customer: 532
Word Size: ---


Attachments
Partial patch (3.81 KB, patch)
2010-08-17 13:58 UTC, Alex Cherepanov
Details | Diff
experimental patch (12.95 KB, patch)
2010-08-27 21:39 UTC, Alex Cherepanov
Details | Diff
patch (6.32 KB, patch)
2010-10-24 22:35 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2010-07-22 06:52:47 UTC
The files fts_18_1805.pdf and fts_18_1812.pdf are rendered by Ghostscript 8.71 and head (r11532) with the images incorrect when compared to Adobe Acrobat 9.3.3.  With 8.71 all four images are wrong, with head two of the four are correct but two are still wrong, see the attached screenshot.
Comment 2 Alex Cherepanov 2010-07-22 17:11:16 UTC
This bug is caused by an image with opacity layer that cannot be
processed correctly by Jasper. No hacking of the output stream
Can restore the image. This includes experiments with DeviceN and
tint transform functions.
Comment 3 Michael Vrhel 2010-07-29 18:01:45 UTC
The pdf interpreter needs to detect SMaskInData true in the file.  In this case, hastransparency should be true and the pdf14 device pushed. The image should be handled as a 3x type and the alpha channel will be interleaved with the image data.  Jasper processes the file just fine, it is GS that is not using the alpha channel properly nor paying attention to the SMaskInData setting.
Comment 4 Alex Cherepanov 2010-08-17 01:30:59 UTC
The following files are also affected by this bug.
fts_17_1700_a4.pdf
fts_17_1701_a4.pdf
Comment 5 Alex Cherepanov 2010-08-17 13:58:18 UTC
Created attachment 6666 [details]
Partial patch

Skip opacity and unknown components during reading of image data.
This improves the image quality (compared to the previous state that
interpreted an opacity channel as yet another data sample) and serves
as a transition to full support of opacity.
Comment 6 Alex Cherepanov 2010-08-17 14:32:42 UTC
The patch has been committed as a rev. 11637.
Comment 7 Alex Cherepanov 2010-08-27 21:39:47 UTC
Created attachment 6679 [details]
experimental patch

This is rather inefficient implementation of opacity in the image that
uses separate streams for the image data and opacity data. It also buffers
opacity data in an reusable stream. This patch is attached in hope that some
parts of the code may be usable.

Proper implementation should use GS extensions that permit interleaved
image and opacity data.
Comment 8 Michael Vrhel 2010-09-24 16:00:36 UTC
*** Bug 691516 has been marked as a duplicate of this bug. ***
Comment 9 Alex Cherepanov 2010-10-24 22:35:47 UTC
Created attachment 6824 [details]
patch

Implement /SMaskInData using images with /SMask and separate streams for the
mask and image data. This patch is essentially the same as the "experimental
patch" posted earlier with a few bug fixes. The interface to /JPXDecode filter
has changed. It takes now /Alpha parameter, which controls whether opacity or
image data stream is extracted.

Our /ImageType 103 seems to have issues and my attempts to use it directly
have failed.

The patch has been committed as a rev. 11845.

The commit introduces a PS error on pdfwrite device in fts_18_1805.pdf 
and a few other files with the same image. However, this image has never
been combined with SMask before and the actual bug is likely to predate
the commit.
Comment 10 Alex Cherepanov 2010-10-27 20:38:32 UTC
Current version is working wit both Jasper and Luratech
libraries. Remaining issues are tracked as separate bugs.