possible bug show: or -combine starting 6.8.6.10

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

Using 6.8.6.10 and 6.8.7.0 the following combine command is displaying a grayscale image with JPG. It works fine under 6.8.6.9 or with PNG. Mac OSX Snow Leopard

convert rose: -separate rose_%d.jpg

# this fails
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine show:
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine 1tmp1.jpg
convert 1tmp1.jpg show:

# this fails
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine show:
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine 1tmp1.png
convert 1tmp1.png show:


convert rose: -separate rose_%d.png

# this works
convert rose_0.png rose_1.png rose_2.png -combine show:
convert rose_0.png rose_1.png rose_2.png -combine 1tmp1.png
convert 1tmp1.png show:
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

Adding -colorspace sRGB after the -combine, does not help Tested again with IM 6.8.7.0

These still fails:
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine -colorspace sRGB show:
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine -set colorspace sRGB show:


However, these works:
convert rose_0.jpg rose_1.jpg rose_2.jpg -set colorspace sRGB -combine show:
convert rose_0.jpg rose_1.jpg rose_2.jpg -colorspace sRGB -combine show:


Magick: Is this a bug or a new requirement/feature?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: possible bug show: or -combine starting 6.8.6.10

Post by dlemstra »

This is a bug and will be fixed in 6.8.7.1
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

dlemstra wrote:This is a bug and will be fixed in 6.8.7.1

Thanks for the reply Dirk.

Do you know if this is related to my other bug report with -separate at viewtopic.php?f=3&t=24188

Fred
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: possible bug show: or -combine starting 6.8.6.10

Post by dlemstra »

It doesn't look like this is related, I will look into the other bug to see what is happening there.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

Here are some examples that seem to show that it might be format related. PNG works, but miff and jpg do not.



This seems to work fine:
convert rose: -separate rose_%d.png
convert rose_0.png rose_1.png rose_2.png -combine newrose.png
display newrose.png

But this comes out grayscale in jpg format:
convert rose: -separate rose_%d.jpg
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine newrose.jpg
display newrose.jpg

But this comes out grayscale in miff format:
convert rose: -separate rose_%d.miff
convert rose_0.miff rose_1.miff rose_2.miff -combine newrose.miff
display newrose.miff
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

Further problems with -combine


Create test sRGB black image and convert to CMYK to see if that works and what the values are in CMYK

convert xc:black xc:black xc:black -combine -colorspace CMYK txt:
# ImageMagick pixel enumeration: 1,1,65535,cmyk
0,0: (0%,0%,0%,100%) #000000000000FFFF cmyk(0,0,0,255)

So the above is fine.


So take the cmyk values and create the reverse

convert xc:black xc:black xc:black xc:white -set colorspace CMYK -combine -colorspace sRGB txt:
Abort trap



convert xc:black -colorspace CMYK \
xc:black -compose CopyCyan -composite \
xc:black -compose CopyMagenta -composite \
xc:black -compose CopyYellow -composite \
xc:white -compose CopyBlack -composite \
-colorspace sRGB txt:


# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (99.990844586861982179%,99.990844586861982179%,99.990844586861982179%) #FFF9FFF9FFF9 srgb(99.990844586861982179%,99.990844586861982179%,99.990844586861982179%)

which comes out as nearly white.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug show: or -combine starting 6.8.6.10

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.7-1 Beta available by sometime tomorrow. You'll also need this command:

Code: Select all

convert xc:black -colorspace CMYK \
  xc:white -set colorspace CMYK -compose CopyCyan -composite \
  xc:white -set colorspace CMYK -compose CopyMagenta -composite \
  xc:white -set colorspace CMYK -compose CopyYellow -composite \
  xc:black -set colorspace CMYK -compose CopyBlack -composite \
  -colorspace sRGB txt:
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

magick wrote:We can reproduce the problem you posted and have a patch in ImageMagick 6.8.7-1 Beta available by sometime tomorrow. You'll also need this command:

Code: Select all

convert xc:black -colorspace CMYK \
  xc:white -set colorspace CMYK -compose CopyCyan -composite \
  xc:white -set colorspace CMYK -compose CopyMagenta -composite \
  xc:white -set colorspace CMYK -compose CopyYellow -composite \
  xc:black -set colorspace CMYK -compose CopyBlack -composite \
  -colorspace sRGB txt:
Why is -set colorspace needed? Is should not be needed since the first line sets the colorspace to CMYK. This is per Anthony's examples at http://www.imagemagick.org/Usage/color_ ... bine_other

And what about the more current approach that aborts


convert xc:black xc:black xc:black xc:white -set colorspace CMYK -combine -colorspace sRGB txt:
Abort trap
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug show: or -combine starting 6.8.6.10

Post by magick »

Does it abort with the latest ImageMagick 6.8.7-1 Beta?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

magick wrote:Does it abort with the latest ImageMagick 6.8.7-1 Beta?

No, that is fine. Thanks.

imbh convert xc:black xc:black xc:black xc:white -set colorspace CMYK -combine -colorspace sRGB txt:
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (0%,0%,0%) #000000000000 black


But this still does not work without -set colorspace CMYK before each -channel (which does work) and I do not understand why that is needed now, when it was not before as per http://www.imagemagick.org/Usage/color_ ... bine_other


imbh convert xc:black -colorspace CMYK \
> xc:black -compose CopyCyan -composite \
> xc:black -compose CopyMagenta -composite \
> xc:black -compose CopyYellow -composite \
> xc:white -compose CopyBlack -composite \
> -colorspace sRGB txt:

# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (100%,100%,100%) #FFFFFFFFFFFF white
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: possible bug show: or -combine starting 6.8.6.10

Post by snibgo »

As for fmw42, on Windows 7, the command ...

Code: Select all

convert xc:black xc:black xc:black xc:white -set colorspace CMYK -combine -colorspace sRGB txt:
... crashed under v6.8.7-0 but succeeds under 6.8.7-1beta, returning the expected result "0,0: (0%,0%,0%) #000000000000 black". Thanks.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

snibgo wrote:As for fmw42, on Windows 7, the command ...

Code: Select all

convert xc:black xc:black xc:black xc:white -set colorspace CMYK -combine -colorspace sRGB txt:
... crashed under v6.8.7-0 but succeeds under 6.8.7-1beta, returning the expected result "0,0: (0%,0%,0%) #000000000000 black". Thanks.
Yes, it does the same for me on my Mac (unix)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug show: or -combine starting 6.8.6.10

Post by fmw42 »

fmw42 wrote:Here are some examples that seem to show that it might be format related. PNG works, but miff and jpg do not.



This seems to work fine:
convert rose: -separate rose_%d.png
convert rose_0.png rose_1.png rose_2.png -combine newrose.png
display newrose.png

But this comes out grayscale in jpg format:
convert rose: -separate rose_%d.jpg
convert rose_0.jpg rose_1.jpg rose_2.jpg -combine newrose.jpg
display newrose.jpg

But this comes out grayscale in miff format:
convert rose: -separate rose_%d.miff
convert rose_0.miff rose_1.miff rose_2.miff -combine newrose.miff
display newrose.miff

The above issues all seem to work correctly now in IM 6.8.7.1 beta

The only remaining issue here is why -set colorspace needs to be added to each line of

imbh convert xc:black -colorspace CMYK \
xc:black -set colorspace CMYK -compose CopyCyan -composite \
xc:black -set colorspace CMYK-compose CopyMagenta -composite \
xc:black -set colorspace CMYK-compose CopyYellow -composite \
xc:white -set colorspace CMYK-compose CopyBlack -composite \
-colorspace sRGB txt:

This was not needed before as per http://www.imagemagick.org/Usage/color_ ... bine_other

Why is this now needed?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug show: or -combine starting 6.8.6.10

Post by anthony »

As it currently stands sometimes -combine needs -set colorspace before. sometimes it needs -set colorspace afterwards. The before case is especially important for the black channel of CMYK, as most colorspaces do not have the 4th channel for -combine to copy the black values into.

But it does NEED a colorspace setting at some point, as it is MISSING information, especially if input images are single channel 'greyscale' images (which is what they should be).

I have said many times. -combine really needs a 'colorspace' argument. The only solution I can see for backward compatibility is to have a new option that does the same job but takes a colorspace argument.

Remember -separate and -combine should only copy values as they are it should not modify the values, only separate and merge the color channels.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply