Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue with ColorSpace #297

Closed
RussellMcOrmond opened this issue Nov 27, 2017 · 6 comments · Fixed by #518 or #542
Closed

Possible issue with ColorSpace #297

RussellMcOrmond opened this issue Nov 27, 2017 · 6 comments · Fixed by #518 or #542
Labels
bug A product defect that needs fixing P2 Medium priority issues to be scheduled in a future release

Comments

@RussellMcOrmond
Copy link

RussellMcOrmond commented Nov 27, 2017

Dev Effort

2D

Description

We have some CMYK which aren't differentiated in the JHOVE 1.16.5 reports. I'm wondering if this is a problem in the software, or that I'm not using the tool correctly.

Using ImageMagick's identify it notices the differences between a lone CMYK image and Greyscale images.

Jhove indicated YCbCr for all of them.

cihm@quark:/opt/wip/Temp/export/oop_issues/oop.debates_HOC0104_01-sip/data/files$ identify -verbose -format "%f %[colorspace]\n" 000?.jpg 
0001.jpg CMYK
0002.jpg Gray
0003.jpg Gray
0004.jpg Gray
0005.jpg Gray
0006.jpg Gray
0007.jpg Gray
0008.jpg Gray
0009.jpg Gray

cihm@quark:/opt/wip/Temp/export/oop_issues/oop.debates_HOC0104_01-sip/data/files$ /opt/jhove/jhove 000?.jpg | grep ColorSpace
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
      ColorSpace: YCbCr
cihm@quark:/opt/wip/Temp/export/oop_issues/oop.debates_HOC0104_01-sip/data/files$ /opt/jhove/jhove -v
Jhove (Rel. 1.16.5, 2017-03-20)
 Date: 2017-11-27 16:38:57 EST
 App:
  API: 1.16.5, 2017-03-20
  Configuration: /opt/jhove/conf/jhove.conf
  JhoveHome: /opt/jhove
  Encoding: utf-8
  TempDirectory: /tmp
  BufferSize: 131072
  Module: AIFF-hul 1.3
  Module: ASCII-hul 1.3
  Module: BYTESTREAM 1.3
  Module: GIF-hul 1.3
  Module: GZIP-kb 0.1
  Module: HTML-hul 1.3
  Module: JPEG-hul 1.2
  Module: JPEG2000-hul 1.3
  Module: PDF-hul 1.8
  Module: PNG-gdm 1.0
  Module: TIFF-hul 1.7
  Module: UTF8-hul 1.6
  Module: WARC-kb 1.0
  Module: WAVE-hul 1.4
  Module: XML-hul 1.4
  OutputHandler: Audit 1.1
  OutputHandler: TEXT 1.5
  OutputHandler: XML 1.7
  Usage: java JHOVE [-c config] [-m module] [-h handler] [-e encoding] [-H handler] [-o output] [-x saxclass] [-t tempdir] [-b bufsize] [-l loglevel] [[-krs] dir-file-or-uri [...]]
  Rights: Derived from software Copyright 2004-2011 by the President and Fellows of Harvard College. Version 1.7 to 1.11 independently released. Version 1.12 onwards released by Open Preservation Foundation. Released under the GNU Lesser General Public License.
cihm@quark:/opt/wip/Temp/export/oop_issues/oop.debates_HOC0104_01-sip/data/files$ 

I noticed this issue when trying to confirm image differences in the context of cantaloupe-project/cantaloupe#177

@carlwilson
Copy link
Member

Hi @RussellMcOrmond, I've taken an initial look and there's not a straightforward fix leaps out at me so I won't be addressing this for 1.18 which goes out today. I'm going to assign @tledoux to this as he implemented the colour space code and might be able to give you a fuller answer.

@tledoux
Copy link
Contributor

tledoux commented Dec 5, 2017

Hi, I implement the colorProfile code for JPEG, not the ColorSpace.

In fact, the problem seems to come from the line 1009 in JpegModule where the presence of a JFIF header wrongly implies a YCbCr color space.

So this seems like a bug (at least, a shortcut) that needs to be corrected.

@RussellMcOrmond, can we add your files to the corpora so that we can build tests for these cases ?

@carlwilson
Copy link
Member

Thanks @tledoux

@RussellMcOrmond
Copy link
Author

RussellMcOrmond commented Dec 6, 2017

Yes, @tledoux , you can use those files as test cases.

You can download using Cantaloupe from our repository, of I can attach them if that is easier. Turns out we only had two CMYK images in that collection which is the title pages of the English and French versions of the same document.

http://parl.canadiana.ca/view/oop.debates_CDC0104_01/1?r=0&s=1
http://parl.canadiana.ca/view/oop.debates_HOC0104_01/1?r=0&s=1

From cantaloupe-project/cantaloupe#177 , to download you:

  • Enable "developer tools" in Chrome, Firebug for Firefox or equivalent that will show network traffic
  • Go to one of the two above URL's
  • The first page will have "There was an error retrieving this page." where on other pages there is an image.
  • Open the URL for the first image in a new tab (It has the 0001.jpg just before /full. Cantaloupe is also only returning 586 bytes, which represent the headers alone). This URL has an authorisation token, which is why I needed to describe it this way. You will note that the page is blank.
  • If you change the /!800,800/ in the URL to /full/ you will see the image directly streamed to you (unmodified by Cantaloupe). Save this file.

@ghost ghost added this to the Release v1.20 milestone Mar 9, 2018
@ghost ghost added the bug A product defect that needs fixing label Mar 9, 2018
@carlwilson
Copy link
Member

Hi @RussellMcOrmond I had a look at this for the 1.20 release but I haven't been able to fix it at a first pass as the research left me a little confused. Reading the APP0 material I've Googled does suggest that the use of a JFIF header implies CMYK. It's also obvious that tools like ImageMagick do more than this but the "rules" aren't straightforward. I agree with @tledoux that the current shortcut should be replace, it's just not currently clear by what.

@ghost ghost removed this from the Release v1.20 milestone Feb 28, 2019
@ghost ghost unassigned tledoux Feb 28, 2019
@ghost ghost added the P2 Medium priority issues to be scheduled in a future release label Feb 28, 2019
@ghost ghost added this to the Hack week initiation milestone Feb 28, 2019
rgfeldman added a commit to rgfeldman/jhove that referenced this issue Apr 10, 2019
tledoux added a commit to tledoux/jhove that referenced this issue Nov 5, 2019
Calculate the appropriate colorspace depending on the number of components and the segments
Add the "Adobe JPEG" profile and the information on the corresponding ISO/IEC 10918-6:2013
Suppress the warning message about deprecated JPEG compression scheme coming from the TIFF module
Add more control on the validity of the format :
- 3 components only for EXIF
- 1, 3 or 4 components for other profiles
Add a YCCK colorspace value to the niso property
The JPEG module goes to version 1.5.2
Fixes openpreserve#297
@thorsted
Copy link

thorsted commented Dec 4, 2019

I wanted to add our use case. We have an image with an ICC Profile "Display P3" which is throwing an ErrorMessage "Invalid ICCProfile in APP2 segment, No description in ICC profile v4" Offset 596. Jpeg is Well-Formed and valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A product defect that needs fixing P2 Medium priority issues to be scheduled in a future release
Projects
None yet
4 participants