B/W Images Lighten on Annotation

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.
Post Reply
indjeto
Posts: 5
Joined: 2016-07-03T07:54:20-07:00
Authentication code: 1151

B/W Images Lighten on Annotation

Post by indjeto »

I saw that on B/W images while trying to annotate them, the whole image becomes lighter than the source image.
For full color images it is ok.
I saw the same affect happens also when trying to composite one small image over the b/w source.

I was using php lib, but also tried with this command:

Code: Select all

convert in2.jpg   -background Orange  label:'Faerie Dragon' +swap  -gravity Center -append out2.jpg
The same effect.

Unfortunately I don't see a way to attach files here :(

I'm using up to date Ubuntu 14.04.4 LTS with imagick from package.
Version: ImageMagick 6.7.7-10 2016-06-01 Q16
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: B/W Images Lighten on Annotation

Post by snibgo »

IM v6.7.7 was confused about grayscale images. I suggest you upgrade to a recent version.
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: B/W Images Lighten on Annotation

Post by fmw42 »

IM 6.7.7.10 had linear grayscale images and swapped RGB and sRGB. That causes the darkening. See viewtopic.php?f=4&t=21269. You would be best off upgrading to a current version of Imagemagick. If you cannot do that, then try

Code: Select all

convert in2.jpg  -set colorspace RGB -background Orange  label:'Faerie Dragon' +swap  -gravity Center -append out2.jpg
But why do you have -background orange. Seems as though you are creating a color image for the label and appending to in2.jpg, which I presume is grayscale. So lets separate the issues. What is getting darkened?

Can you post your input in2.jpg and out2.jpg to some place such as dropbox.com, so we can see what is going on and test with your command.
indjeto
Posts: 5
Joined: 2016-07-03T07:54:20-07:00
Authentication code: 1151

Re: B/W Images Lighten on Annotation

Post by indjeto »

Thanks all for the replies.
I attached the files here: http://ge.tt/2kvlr8c2

fmw42, the original image got lightened. I tried changing Orange with White, but the same effect.

I tried this command and it worked fine:

Code: Select all

convert in2.jpg -background Orange  label:'Faerie Dragon' +swap  -gravity Center -append -colorspace RGB out2.jpg
I'm don't understand very much the details but if I always use this param for all site images, it may broke the non b/w ones?

I'm curious and if this is fixed in the new version and which one will you recommend.

As a last resort I will try to build it from source as I'm having the last ubuntu package.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: B/W Images Lighten on Annotation

Post by fmw42 »

On my current IM 6.9.5.0 Q16 Mac OSX, this works fine.

Code: Select all

convert in2.jpg -background Orange  label:'Faerie Dragon' +swap  -gravity Center -append out.jpg
On IM 6.7.7.10 Q16 Mac OSX, the above produces a lighter image.

But the following works fine for me on 6.7.7.10 without lightening the image. Note where I put the -set colorspace RGB. You put -colorspace RGB at the end, which is not what I wrote before.

Code: Select all

convert in2.jpg -set colorspace RGB -background Orange  label:'Faerie Dragon' +swap  -gravity Center -append out.jpg
IM 6.7.7.10 is over 170 versions old. I would recommend that you upgrade to the current IM.


EDIT: In further review of the results, my 6.7.7.10 system did not work to put in the label, so I cannot say if it properly works. It is just too old a release for my current delegates. But try my exact command above and let us know if that works.
indjeto
Posts: 5
Joined: 2016-07-03T07:54:20-07:00
Authentication code: 1151

Re: B/W Images Lighten on Annotation

Post by indjeto »

fmw42,

Code: Select all

convert in2.jpg -set colorspace RGB -background Orange  label:'Faerie Dragon' +swap  -gravity Center -append out.jpg
did not work.
It works only when you put it at the end.
I found and some other issues with my version, trying to auto orient images, so it seems installing a new version will be a better option.

At Image magick's site the last version is 7. What will you recommend 7 or 6.9?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: B/W Images Lighten on Annotation

Post by fmw42 »

You can use either, but with v7 you need to use magick in place of convert. See http://imagemagick.org/script/porting.php#cli.
indjeto
Posts: 5
Joined: 2016-07-03T07:54:20-07:00
Authentication code: 1151

Re: B/W Images Lighten on Annotation

Post by indjeto »

I'm using it from php.
I updated to ImageMagick-7.0.2-2.
It works as expected.
Post Reply