alpha image with tranparent background

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
prateek2k10
Posts: 13
Joined: 2011-07-18T21:57:12-07:00
Authentication code: 8675308

alpha image with tranparent background

Post by prateek2k10 »

when we composite any image having transparent background with alpha set then background of the image getting black in the latest version 6.7.1. plz help me its urgent
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

Command? Image file format? Example image?

Not all image file formats understand transparency. JPEG being the most common no-transparent image file format.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
prateek2k10
Posts: 13
Joined: 2011-07-18T21:57:12-07:00
Authentication code: 8675308

Re: alpha image with tranparent background

Post by prateek2k10 »

command we using
exec('composite -blend '.$percentage.' "'.$input.'" -size "'.$width.'"x"'.$height.'" xc:transparent -alpha Set png:"'.$convertpath.'"');

image file format - png, jpg

we were using these components.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

That works fine for me in my tests. the -alpha set is not needed, as the background image is 'transparent' already.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
prateek2k10
Posts: 13
Joined: 2011-07-18T21:57:12-07:00
Authentication code: 8675308

Re: alpha image with tranparent background

Post by prateek2k10 »

thanks for your support but i m again getting the "Black" background plz check your version bec's in previous version output was fine but in latest version the output is in black background
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

Can you expand the variables in the command?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

Also what relation is the 'size' argument to your input image? The same size.
If so it looks like you are only trying to add 50% transparency. Try this...

Code: Select all

   convert input_image.png -alpha set -channel A -evaluate multiply 0.5 +channel output_image.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
prateek2k10
Posts: 13
Joined: 2011-07-18T21:57:12-07:00
Authentication code: 8675308

Re: alpha image with tranparent background

Post by prateek2k10 »

exec('composite -blend "20" "textLabel.png" -size "200X200" xc:transparent -alpha Set png:"rose.png"');

that is we use, and if we use white or some other color in place of "transparent" it works but transparent and either "none" is not working.
prateek2k10
Posts: 13
Joined: 2011-07-18T21:57:12-07:00
Authentication code: 8675308

Re: alpha image with tranparent background

Post by prateek2k10 »

i was made all the efforts but its not working and your code is also not working could you plz tell me how to change the version of imagemagick on linux server and what is the role of the RPM file in installation
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

Very strange as it is working for us.

A "Display" of the resulting image shows a very faint image of my input image on a checkerboard underlay.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

prateek2k10 wrote:i was made all the efforts but its not working and your code is also not working could you plz tell me how to change the version of imagemagick on linux server and what is the role of the RPM file in installation
The RPM file is just a pre-compiled package, that is installed so that it can be removed or updated (patched) as need by the system. Basically t tracks what files are installed, and if someone modifies its default configuration (so it can preserve it)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
prateek2k10
Posts: 13
Joined: 2011-07-18T21:57:12-07:00
Authentication code: 8675308

Re: alpha image with tranparent background

Post by prateek2k10 »

ok do one thing with your output(image) open it in the Photoshop if it is fine then plz send me image. if possible
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha image with tranparent background

Post by anthony »

First I am not a windows user. Linux only. So no photoshop.
second you never gave a link to your source image. So I used a PNG created using
convert rose: input.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply