Page 1 of 1

can't get white background for display or convert

Posted: 2010-03-14T11:30:52-07:00
by MikeR
I've just installed ImageMagick 6.5.1-0 2009-08-27 Q16 for a fresh install of Ubuntu 9.10 Karmic Koala OS. When I open an encapsulated postscript file there is a gray checkerboard pattern for background. I'm almost certain it should be white background, as other image display software like ghostview and XV show white. The documentation says default background for ImageMagick is white. My previous version of ImageMagick on an older version of Ubuntu worked as expected. I should mention that I'm primarily interested in converting the EPS to GIF using this software.

Re: can't get white background for display or convert

Posted: 2010-03-14T11:37:18-07:00
by snibgo
I don't think IM will ever create a chequer backgound, unless you ask it to. Perhaps your image viewer is showing that for transparency.

Please post your EPS file and exact command you are using.

Re: can't get white background for display or convert

Posted: 2010-03-14T11:58:47-07:00
by fmw42
If your file has transparency and you use the display or show: options to display in X11, then you will get a checker background (not too sure about display as it has changed behavior on my Mac lately). But show: does have a checker background when use to view your transparent image. Display has options that allow you to specify a background image when you have transparency. see http://www.imagemagick.org/script/display.php

convert image.png show:

display image.png

Re: can't get white background for display or convert

Posted: 2010-03-14T12:27:57-07:00
by MikeR
snibgo: How do I post the image file? I do not have a dedicated web site for this purpose.

fmw4: Not sure I follow what you're saying.

I'm using the display command, but the checkerboard background also shows when I use the open function in ImageMagick GUI.

I also note that the test png file image.png found here:

http://www.imagemagick.org/Usage/

also shows checkerboard background pattern in ImageMagick, but not with other viewers.

The display command properly renders JPG and GIF images. Seems that these EPS I've created with PGPLOT are the problem.

Re: can't get white background for display or convert

Posted: 2010-03-14T12:50:37-07:00
by fmw42
the various IM display devices, display, show: and the GUI will put a checkerboard background underneath the transparent parts of the image. Other views may or may not do that.

To post an image, you need to find some free image web site, post your image there and then put a link in your messages here to that image file. There are a number of free sites that will allow you to post an image.

Re: can't get white background for display or convert

Posted: 2010-03-14T13:03:30-07:00
by MikeR
I've now tested my EPS image file, created with PGPLOT, using:

evince
ghostview
GIMP photo editor

All render the image as expected. But as I mentioned, ImageMagick gives me a checkerboard background.

As a test, I've downloaded another EPS file from here:

http://www.freevectors.com/vector_graphic/97

The three applications above all show the image as salmon color over white background. ImageMagick on my Ubuntu 9.10 OS shows not a checkerboard, but, rather, blue streaks on black.

Re: can't get white background for display or convert

Posted: 2010-03-14T13:17:19-07:00
by MikeR
EPS file (test.eps) posted to:

http://www.badongo.com/file/21239896

Re: can't get white background for display or convert

Posted: 2010-03-14T14:39:57-07:00
by fmw42
MikeR wrote:EPS file (test.eps) posted to:

http://www.badongo.com/file/21239896
I have downloaded this and opened it in IM using

convert test.eps show:

and it shows a checker background because the image is transparent. If I display it in some other tool, such as Mac Preview or GraphicConverter, it shows with a white background. This is just the way various tools deal with indicating where the image is transparent.

When I use the IM GUI or display test.eps, the image shows with no background and one can see through to the windows underneath.

This seems to be a Mac issue as I have raised it before and was told it could not be reproduced on Linux and that Linux would show checkerb oard background where the image is transparent.

Having the checkerboard there does not mean that it is part of the image. Only that the image is transparent and the display device is indicating that by putting a checkerboard underneath the image.

Re: can't get white background for display or convert

Posted: 2010-03-14T14:51:56-07:00
by MikeR
1) Imagemagick used to display like other viewers. It is unfortunate that is does not do so now.

2) I have tried to make the transparent background white, using -background and transparent-color. No luck

Regarding 1), why the change?

I'd previously been able to do a very simple conversion from EPS to GIF using convert command. No longer. Linux really needs a decent, straightforward conversion tool to do this. I've brought that up on Ubuntu forums.

Re: can't get white background for display or convert

Posted: 2010-03-14T15:08:12-07:00
by fmw42
there is nothing wrong with the IM display in principle. it is a choice of how to deal with transparency. what do you show behind the transparent parts? IM chose to put a checkerboard background to re-inforce that it is transparent. other systems just put white or black or gray and so you have no idea whether it is transparent or not.

this works for me!

convert test.eps -background white -flatten test.gif

convert test.gif show:

That makes the transparent parts white and remove the transparency all together and show: does not show the checkerboard any longer as the image is not transparent and has a true white background in the image.

Re: can't get white background for display or convert

Posted: 2010-03-14T15:37:20-07:00
by MikeR
Agreed. I note the -flatten option you mention produces a white background. Moreover, I've just found that I can force my graphics software to underlay a white background on each image. Thanks for the help.

Re: can't get white background for display or convert

Posted: 2010-03-14T15:45:28-07:00
by fmw42
MikeR wrote:Agreed. I note the -flatten option you mention produces a white background. Moreover, I've just found that I can force my graphics software to underlay a white background on each image. Thanks for the help.
-flatten can make any color background, the color is controlled by the -background setting

if you leave off the -background, then I believe it defaults to white.