[resolved] Create a transparent png file

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
Florian26
Posts: 8
Joined: 2014-06-04T13:00:38-07:00
Authentication code: 6789

[resolved] Create a transparent png file

Post by Florian26 »

Hello,

Someone can say me how i can create a transparent png file ?
I have try with :

Code: Select all

exec('convert -size 100x100 xc:none fond.png');
exec('convert -size 100x100 -xc:none fond.png');
exec('convert -size 100x100 xc:transparent fond.png');
exec('convert -size 100x100 -xc:transparent fond.png');
exec('convert -size 100x100 -transparent fond.png')
But nothing work... i have no idea !

Thanks to your answer :)
Last edited by Florian26 on 2014-06-27T10:03:32-07:00, edited 1 time in total.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Create a transparent png file

Post by glennrp »

Code: Select all

convert -size 100x100 xc:none fond.png
works for me from the commandline, using ImageMagick 6.8.9-4 Q16 x86_64 2014-06-24
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Create a transparent png file

Post by Bonzo »

Are you just looking at the thumbnail?

In Windows I get a black thumbnail but when open it is transparent.
Florian26
Posts: 8
Joined: 2014-06-04T13:00:38-07:00
Authentication code: 6789

Re: Create a transparent png file

Post by Florian26 »

Thanks to your answer :)

@glennrp : I have "ImageMagick-6.8.9-4-Q8-x64-dll.exe" (http://www.imagemagick.org/script/binar ... hp#windows) ... and a black image :/
My server will work with OS 64 bits so i prefer to use 64 bits ImageMagick

@bonzo : I have a black image, and when i open it with Photoshop, it's black image. When i open it with the IM's exe, it's transparent... How can i have a transparent image to all application ? And to see transparent in the web
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create a transparent png file

Post by fmw42 »

This should fix it.

Code: Select all

exec('convert -size 100x100 xc:none PNG32:fond.png');
Your IM command produces only one color transparent black. The image is bilevel alpha and apparently PS sees it as binary only and ignores the alpha. Setting PNG32: will make it 32 bit color.

This works also by setting it to palette alpha 8bit color with transparency.

Code: Select all

exec('convert -size 100x100 xc:none PNG8:fond.png');
Florian26
Posts: 8
Joined: 2014-06-04T13:00:38-07:00
Authentication code: 6789

Re: Create a transparent png file

Post by Florian26 »

Black again in the windows explorer, but in photoshop, it's transparent !

Thanks a lot ! :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [resolved] Create a transparent png file

Post by anthony »

How old is your windows explorer!

Old versions had major probelms with transparent PNG's but that should now be fixed. But then I am not a Windows user! ;-)
See this on the very TOP LEVEL of the IM Usgae web site
http://www.imagemagick.org/Usage/#PNG
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: [resolved] Create a transparent png file

Post by Bonzo »

Mine is Windows 7 and it shows a black thumbnail but when open it's OK

I was working with a server side image map and that has a problem in IE11 and Microsoft knew about the problem in IE9.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [resolved] Create a transparent png file

Post by snibgo »

Perhaps there is confusion on this thread between:

- Windows Explorer: a graphical interface to the file system;
- Windows Internet Explorer: a web browser.

In Windows 8.1, bang up-to-date, Windows Explorer shows a PNG or TIFF that is entirely transparent black (or transparent white or transparent pink etc) as black (or white or pink etc).
snibgo's IM pages: im.snibgo.com
Post Reply