Trying to merge print TIF files results in weird colors & other problems

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
paratron
Posts: 5
Joined: 2019-09-25T03:05:59-07:00
Authentication code: 1152

Trying to merge print TIF files results in weird colors & other problems

Post by paratron »

Hey,
I am trying to merge three TIF files with CMYK colors into one. This is the command I used:

Code: Select all

 magick *.tif -background white +smush 700 ./combined.tif
This is the result:

Image

Somehow, the colorspace gets messed up. I tried several variations of the command, up until downloading the US Web Coated (SWOP) ICC Color profile and telling imagemagick to use it:

Code: Select all

magick *.tif -colorspace CMYK -background white +smush 700 -profile ./USWebCoatedSWOP.icc ./combined.tif
The result was the same. Also a strange effect as well: trying to open the resulting TIF in Photoshop results in an error message telling me I don't have anough RAM on my machine. I have 16GBs of RAM and the resulting file has a size of 20mb...

IrfanView opens the TIF just fine but shows the broken colors.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to merge print TIF files results in weird colors & other problems

Post by snibgo »

What version of IM, on what platform?

You might convert each input to sRGB, then smush them. If you want a CMYK output, you could convert them to CMYK at the end.

As you haven't provided the input files, that's the only advice I can give.
snibgo's IM pages: im.snibgo.com
paratron
Posts: 5
Joined: 2019-09-25T03:05:59-07:00
Authentication code: 1152

Re: Trying to merge print TIF files results in weird colors & other problems

Post by paratron »

The version is 7.0.8-66 Q16 x64 on Windows 10.

I seem to come closer to my desired result with this command - at least in the windows preview + IrfanView, it looks okay now. Photoshop still refuses to open the result file.

Code: Select all

magick *.tif -background white +smush 700 -profile "./USWebCoatedSWOP.icc" -negate -colorspace cmyk -compress lzw -define tiff:endian=LSB -endian LSB ./combined.tif
Image

I stored all source files and the result file in this ZIP archive: https://www.dropbox.com/s/ye5ds1f2fbyv4 ... e.zip?dl=0
paratron
Posts: 5
Joined: 2019-09-25T03:05:59-07:00
Authentication code: 1152

Re: Trying to merge print TIF files results in weird colors & other problems

Post by paratron »

Okay, here is an update:

The command needs to be extended by "-define tiff:rows-per-strip=1" - to be able to open the file in photoshop.

The result is nearly perfect. Only the colors seem to get distorted in the process:

Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to merge print TIF files results in weird colors & other problems

Post by snibgo »

The file 761.0-422941b2.tif is CMYK but has no embedded profile. You have decided to assign USWebCoatedSWOP.icc . Why? How do you know that is the correct profile?
snibgo's IM pages: im.snibgo.com
paratron
Posts: 5
Joined: 2019-09-25T03:05:59-07:00
Authentication code: 1152

Re: Trying to merge print TIF files results in weird colors & other problems

Post by paratron »

All source TIFs should not have an embedded profile. I was just playing around - the SWOP profile is the one my printing agency is using, but we can leave it out for now. If I omit the profile option, the result does not differ for me. Colors are lost in the process.

Also what I fail to understand is why I need the -negate option. If I omit it, the result image colors are negated. Is it possible that IM internally only works with sRGB and is required to convert the colors from cmyk to sRGB and then back to cmyk before saving?
paratron
Posts: 5
Joined: 2019-09-25T03:05:59-07:00
Authentication code: 1152

Re: Trying to merge print TIF files results in weird colors & other problems

Post by paratron »

Okay, I found the villain. It was the `smush` command.

This results in an image with broken colors:

Code: Select all

magick *.tif +smush 700 result.tif
While this works fine:

Code: Select all

magick *.tif -splice 700x0+0+0 +append -chop 700x0+0+0 result.tif
It seems like when using smush, imagemagick will generate a new image canvas in sRGB and without color settings and place the input images inside, resulting in flawed output while append seems to work with the original input image settings. I have no idea. Its just a belly feeling. :D

However, this is my final command which also results in TIF files that can be opened by photoshop:

Code: Select all

magick *.tif -splice 700x0+0+0 +append -chop 700x0+0+0 -compress lzw -define tiff:endian=LSB -endian LSB -define tiff:rows-per-strip=1 result.tif
Post Reply