Bug 1369984 - gscan2pdf v1.3.8 saves imported PDF pages as negative images
Summary: gscan2pdf v1.3.8 saves imported PDF pages as negative images
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gscan2pdf
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL: https://sourceforge.net/p/gscan2pdf/b...
Whiteboard:
Depends On: 1378891 1378895
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-25 01:47 UTC by bob
Modified: 2016-10-10 21:49 UTC (History)
4 users (show)

Fixed In Version: gscan2pdf-1.5.2-2.fc26 gscan2pdf-1.5.2-2.fc25 gscan2pdf-1.3.9-2.fc24
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-10 17:46:01 UTC


Attachments (Terms of Use)
test case 1 - single page scanned and saved (129.59 KB, application/pdf)
2016-08-25 03:11 UTC, bob
no flags Details
test case 2 - same document, another page scanned. old image reversal. (316.09 KB, application/pdf)
2016-08-25 03:13 UTC, bob
no flags Details


Links
System ID Priority Status Summary Last Updated
CPAN 118047 None None None 2016-09-23 12:08:57 UTC

Description bob 2016-08-25 01:47:21 UTC
Description of problem:

I am using gscan2pdf v. 1.3.8 with a HP ScanJet ADF scanner.  The software scans new pages properly.  It has a problem, however, in appending newly scanned pages to a previously scanned document.  I open the software and use the File > Open menu to select a PDF file to import.  The PDF file was created with a previous version of gscan2pdf on F23.  I have since performed a clean bare metal install of F24 including gscan2pdf v1.3.8.  

gscan2pdf appears to properly import the existing pages from the old PDF.  All images appear normal.  

gscan2pdf appears to properly scan several new pages.  All page images appear normal.  

All pages are then saved by clicking on the "Select All Pages" button, and then clicking the "Save" button.  During the save, I request to over-write an existing file.  The save process appears to proceed normally ... until the PDF file is opened for viewing.  

Okular is automatically used to display the newly created PDF file (I am using the KDE spin).  When the PDF is opened, all pages appear as a negative image.  ie: scanned pieces of paper that were imported from the old PDF, which should appear as black lettering on white text, appear as white lettering on black text, while the newly scanned pages appended to the document during the last scanning run appear properly as black type on white paper.

If this process is repeated, all of the imported images look fine during use of the program, and new images can be scanned.  Everything looks normal during use of the program, but after a save, all of the pages imported from the old PDF are now rendered as negative images, and only those from the most recent scan event are rendered as positive images.  Somehow during the save, the old images are having their B&W color scheme reversed.



Version-Release number of selected component (if applicable):

gscan2pdf v1.3.8

How reproducible:

Always

Steps to Reproduce:
1. Import an old pdf
2. Append newly scanned pages
3. Everything looks fine.
4. Save
5. View new pdf file, and all of the imported images are white on black, while all of the newly scanned images are black on white.

Actual results:

Negative reversal of imported B&W images from previous PDF occurs during save.

Expected results:

No reversal of image color.

Additional info:

None.

Comment 1 bob 2016-08-25 01:49:59 UTC
Previous description has a typo.  the last 2 paragraphs should read as follows:


Okular is automatically used to display the newly created PDF file (I am using the KDE spin).  When the PDF is opened, all pages appear as a negative image.  ie: scanned pieces of paper that were imported from the old PDF, which should appear as black lettering on white background, actually appear as white lettering on black background, while the newly scanned pages appended to the document during the last scanning run appear properly as black type on white background.

If this process is repeated, all of the imported images look fine during use of the program, and new images can be scanned.  Everything looks normal during use of the program, but after a save, all of the pages imported from the old PDF are now rendered as negative images, and only those from the most recent scan event are rendered as positive images.  Somehow during the save, the old images are having their B&W color scheme reversed.

Comment 2 bob 2016-08-25 03:11:42 UTC
Created attachment 1193854 [details]
test case 1 - single page scanned and saved

test case 1 - single page scanned and saved

Comment 3 bob 2016-08-25 03:13:00 UTC
Created attachment 1193855 [details]
test case 2 - same document, another page scanned.  old image reversal.

test case 2 shows what happens when an existing pdf is imported, a new page is scanned, and the document saved.  the original document has it's image reversed when the new document is saved.

Comment 4 Petr Pisar 2016-08-31 14:31:24 UTC
Thank you for the detailed description. I can reproduce it.

Comment 5 Petr Pisar 2016-08-31 15:07:50 UTC
I think it's caused by some change in other packages upgraded between Fedora 23 and 24. The simplest reproducer is importing a PDF and then saving it.

Comment 6 Petr Pisar 2016-09-23 11:56:48 UTC
So far I found one bug and one difference.

When storing saving to PDF, gscan2pdf converts all pages from PNG into TIFF and the again from TIFF to TIFF and that writes the TIFF images into PDF.

The difference is somewhere in the conversion between the PNG and the second TIFF. Fedora 23 produces 1bpp TIFF, while Fedora 24 produces 8bpp TIFF.

The bug is PDF::API2 used for writing TIFF into PDF mishandles the 8bpp TIFF and produces a PDF with broken image. This happens on Fedora 23 and 24, but it's visible only on Fedora 23 as there is the 8bpp TIFF.

Comment 7 Petr Pisar 2016-09-23 11:58:29 UTC
s/visible only in Fedora 23/visible only on Fedora 24/.

Comment 8 Petr Pisar 2016-09-23 12:42:24 UTC
The difference is in converting 1bpp PNG into TIFF by Image::Magick. Fedora 23 produces 1bpp TIFF, Fedora 24 produces 8bpp TIFF.

Comment 9 Petr Pisar 2016-09-30 14:42:58 UTC
I applied an workaround until ImageMagick will be fixed.

Comment 10 Fedora Update System 2016-09-30 20:23:08 UTC
gscan2pdf-1.5.2-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-14e8e1583d

Comment 11 Fedora Update System 2016-10-01 05:27:23 UTC
gscan2pdf-1.3.9-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-6d7dcc529f

Comment 12 Fedora Update System 2016-10-10 17:46:01 UTC
gscan2pdf-1.5.2-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2016-10-10 21:49:36 UTC
gscan2pdf-1.3.9-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.