Getting blank transparent canvas

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
phpknight

Getting blank transparent canvas

Post by phpknight »

Quick question: I create a blank canvas with -size 1000x1000 xc:none. On it, I write annotate something. Works perfectly. But for some reason, if I get a blank canvas and do not annotate, it just comes out as a big black square instead of fully transparent. How do I get a transparent canvas? Note that I need a transparent canvas through alpha. I cannot pick a transparent color because I don't know what colors people will use.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Getting blank transparent canvas

Post by Bonzo »

Save as a png or gif. jpg does not support transparency.
phpknight

Re: Getting blank transparent canvas

Post by phpknight »

I am saving as a PNG. In fact, I only use PNGs. I know the transparency works a little because if I write anything--even something very small--it is transparent. But if I just make the transparent canvas and save it, it is a black square.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Getting blank transparent canvas

Post by Bonzo »

Strange; I created the canvas in php ( do most of my work in php ) and its clear.

Its shows up as black in the windows thumbnail but when its displayed on a webpage its transparent.
phpknight

Re: Getting blank transparent canvas

Post by phpknight »

I am using PHP as well (exec). Is it transparent when it shows up in something like Photoshop?

What I do is create a big square, and then I resize it smaller to show it on the web browser. It shows up black. Like I said, though, if I write something little on there, then all of the sudden it is right.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Getting blank transparent canvas

Post by Bonzo »

In Gimp I get the grey chequer board indicating transparency.

Code: Select all

exec("convert -size 1000x1000 xc:none canvas.png");
Here is the image I created - only 100x100
http://www.rubblewebs.co.uk/TESTS/canvas.png
phpknight

Re: Getting blank transparent canvas

Post by phpknight »

Okay, when I save yours, I do see the checkerboard. I even tried the same thing you did (100x100), but all my images come out black (even the ones that don't show up in the browser). The only difference is that I have to exec the full path to convert, but I don't see why that would make a difference.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Getting blank transparent canvas

Post by Bonzo »

Thats strange; what if you use -background rather than xc:
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting blank transparent canvas

Post by fmw42 »

Might be your version of IM. What version are you using? It could also be your browser for display.
Post Reply