Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

enter image description here enter image description here enter image description here enter image description here

  1         2      3      4
  • Image 1 is the original main file as displayed by ImageMagick display. It is showing up as a negative, but shouldn't be. When displayed using other tools, it's normal.
  • Image 2 is Image 4 appended to Image 1 using `convert main.jpg footer.jpg -append output.jpg. The main part is still negative, but the footer is normal
  • Image 3 is the same file as Image 2, but as displayed by Windows Preview (it's the same in anything but IM display). The main image is normal, but the footer is negative.
  • Image 4 is the footer file which displays normally by itself in all utilities.

I have tried doing:

convert main.jpg -negate footer.jpg  -append -negate output.jpg

but that makes the footer almost completely black (but it displays correctly in IM display!). It also has the disadvantage that it doesn't do the right thing for images that are correct to start with.

The problem is that I have a large batch of files to process and some of them don't exhibit this problem. Using identify -verbose, I've found that some of the problematic files seem to be more likely to have "Resolution" that's equal or near the Geometry dimensions of the image. Images that have "Resolution" that's higher than or significantly lower than the Geometry seem to be less likely to exhibit this problem.

The main images are all 350x350 pixels and the footer is 350x60.

Other differences (from identify -verbose) that may be significant:

Image: NORMAL.jpg                      Image: NEGATIVE.jpg
  Format: JPEG                            Format: JPEG
  Class: DirectClass                      Class: DirectClass
  Geometry: 350x350+0+0                   Geometry: 350x350+0+0
  Resolution: 100x100                     Resolution: 338.66x338.66
  Print size: 3.5x3.5                     Print size: 1.03348x1.03348
  Units: Undefined                        Units: PixelsPerInch
  Type: TrueColor                         Type: ColorSeparation
  Endianess: Undefined                    Endianess: Undefined
  Colorspace: RGB                         Colorspace: CMYK
  Depth: 8-bit                            Depth: 8-bit
  Channel depth:                          Channel depth:
    red: 8-bit                              cyan: 8-bit
    green: 8-bit                            magenta: 8-bit
    blue: 8-bit                             yellow: 8-bit
                                            black: 8-bit

I've tried this using IM 6.5.1-0 and 6.6.8-3 in Linux and 6.5.2-5 in Windows.

How can I reliably diagnose what's causing this and correct it automatically? How can I append these images in a batch without having to do a lot of manual intervention?

I apologize for the small snippets, but these are copyrighted images.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It turns out that the colorspace was the issue. I solved the problem by converting it from CMYK to RGB.

identify -verbose *.{jpg,JPG} |
    grep -E '^(Image:|[[:blank:]]+Colorspace: CMYK)'|
    grep -Po 'Image: \K.*' |
    xargs -I % convert % -colorspace RGB footer.jpg  -append combined/%
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.