Page 1 of 1
Create image with #444444 background color problem.
Posted: 2014-01-08T17:31:44-07:00
by novito
Hi,
Why the following code:
Code: Select all
convert -size 100x100 xc:#444444 whatever.png
Would return a white backgrounded image?
I mean, #444444 is not white, it's mostly gray. I fail to see why would that happen.
By the way, I am using:
Version: ImageMagick 6.7.7-10 2013-09-10 Q16
http://www.imagemagick.org
Under Ubuntu 12.04
Thanks
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T20:02:57-07:00
by fmw42
put double quotes around the hex value
convert -size 100x100 xc:"#444444" whatever.png
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T21:55:15-07:00
by novito
Hi,
Thanks for the quick reply (as always

)
That didn't do the trick. I still see a white backgrounded image.
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T21:56:22-07:00
by novito
I have been told a guy got it working without the quotes on ImageMagick 6.6.0-4 2011-12-10 Q16
Also, notice that when using jpg format, it works fine.
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T22:42:03-07:00
by fmw42
Quotes are required on Linux/Mac systems to avoid conflict with #. See Example Usage at
http://www.imagemagick.org/script/color.php
I suspect that perhaps your libpng may be corrupt or too old. What version are you using? See PNG listing from
convert -list format
Also what delegates do you have installed from
convert -list configure
at the line starting with DELEGATES
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T22:47:47-07:00
by novito
Conver --list format (PNG related info) gives me this:
PNG* PNG rw- Portable Network Graphics (libpng 1.2.49)
See
http://www.libpng.org/ for details about the PNG format.
PNG24* PNG rw- opaque 24-bit RGB (zlib 1.2.7)
PNG32* PNG rw- opaque or transparent 32-bit RGBA
PNG8* PNG rw- 8-bit indexed with optional binary transparency
convert --list configure (DELEGATES) gives me this:
DELEGATES bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
Thanks.
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T22:50:00-07:00
by fmw42
What tool are you using to determine that the color is white? Are you displaying the image somewhere or using identify -verbose yourimage?
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T22:56:43-07:00
by fmw42
I can verify that I get the same result as you on that old version of IM. It fails for png (with a more current version of libpng) and works for jpg. Looks like you need to upgrade IM to a more current version.
I am using:
PNG* PNG rw- Portable Network Graphics (
libpng 1.5.17)
im67710update convert -size 100x100 xc:"#444444" whatever.png
Code: Select all
identify -verbose whatever.png
Image: whatever.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: PseudoClass
Geometry: 100x100+0+0
Resolution: 72x72
Print size: 1.38889x1.38889
Units: Undefined
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 8/4-bit
Channel depth:
gray: 1-bit
Channel statistics:
Gray:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Colors: 1
Histogram:
10000: (255,255,255) #FFFFFF gray(255)
im67710update convert -size 100x100 xc:"#444444" whatever.jpg
Code: Select all
identify -verbose whatever.jpg
Image: whatever.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 100x100+0+0
Resolution: 72x72
Print size: 1.38889x1.38889
Units: PixelsPerInch
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 8/4-bit
Channel depth:
gray: 4-bit
Channel statistics:
Gray:
min: 68 (0.266667)
max: 68 (0.266667)
mean: 68 (0.266667)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Colors: 1
Histogram:
10000: ( 68, 68, 68) #444444 gray(68)
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T22:58:27-07:00
by novito
Interesting...
So you say I would need to update IM? Don't you mean libpng? I am confused as, I am using all this through the Ruby RMagick gem, and I haven't had to install any libpng at all, so am not sure when that got installed (maybe through IM itself?)
Thanks a lot...
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T23:01:18-07:00
by fmw42
No it is not libpng because I was using a much more current version of libpng and it failed.
Here is a workaround -- create as miff and pipe to convert to png
convert -size 100x100 xc:"#444444" miff:- | convert - whatever2.png
or use tiff output if you do not want the jpg compression
convert -size 100x100 xc:"#444444" whatever.tiff
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T23:03:49-07:00
by novito
This is weird though. Which version of IM you have that is working? I might want to update to that version.
Re: Create image with #444444 background color problem.
Posted: 2014-01-08T23:09:41-07:00
by fmw42
It works fine for me on IM 6.8.8.1 Q16 Mac OSX. It fails when I use IM 6.7.7.10 Q16 Mac OSX. Both are using the same version of libpng
PNG* PNG rw- Portable Network Graphics (libpng 1.5.17)
It may have been just a bug in that one version. But I cannot say for sure without testing further version.
If you have to upgrade, upgrade to the highest (more current) version of IM just to get all the bug fixes and new features. IM 6.7.7.10 is over 100 versions old.
Re: Create image with #444444 background color problem.
Posted: 2014-01-10T10:25:32-07:00
by novito
Hi!
Upgrading to ImageMagick 6.8.8-1 Q16 i686 2014-01-10
http://www.imagemagick.org
did the trick.
Now my problem is that the Ruby library (RMagick), somehow I guess is still using the old version, because I still have the same problem when creating images from it.
Thanks