Saving converted images without applying the alpha layer

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
psycosyd
Posts: 5
Joined: 2011-08-29T09:38:24-07:00
Authentication code: 8675308

Saving converted images without applying the alpha layer

Post by psycosyd »

Greetings all,

I have been struggling with this problem for a while now. It seems simple enough but I am not quite able to create the result I want. I am currently trying to convert an image to a psd type to be opened later. When I do a straight conversion the alpha layer is applied to the resulting images, so I lose the original full image. For example, using the tutorials found at http://www.imagemagick.org/Usage/masking/#alpha_off I have as my background the resulting image of the "convert moon.png -alpha off alpha_off.png" command. My alpha layer creates the first image, with the moon. When I do my image conversion, the resulting psd has the alpha layer I want (that would create the moon shape) but the rbg image also has applied the alpha, and so I dont preserve the original full image background, only what is under the white part of my alpha layer.

It is not enough for me to use:

convert moon.png -alpha off -alpha set alpha_set.psd

as then my alpha layer is lost and saved as completely opaque and white.

I had thought to use the above command and then use Dst_In with the initial image to copy the alpha layer but once again I get the same problem I had before, where I lose the background image without the alpha layer.

So, I was wondering if anyone could clue me in on how to solve this... hopefully I explained things well enough too.

Thanks for the help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving converted images without applying the alpha layer

Post by fmw42 »

I am not sure I understand what you are trying to do. It might be best to post links to your input image and any test result images with your command line and then explain what it is you want to have as a result.

Please note that PSD images have two kinds of transparency -- background transparency and alpha channel transparency. IM currently can only handle the alpha channel transparency. So if your input image has background transparency then you may be out of luck.
psycosyd
Posts: 5
Joined: 2011-08-29T09:38:24-07:00
Authentication code: 8675308

Re: Saving converted images without applying the alpha layer

Post by psycosyd »

I figured it would be a bit confusing

Here is my initial image, in this example it happens to be a tga.

http://www.freeimagehosting.net/0d350

As you can see, there are the rbg channels and the alpha channel.

This is the result after my basic convert command
convert original_image.tga final.psd

http://www.freeimagehosting.net/e7873

As you can see, the rgb channels have applied the alpha layer, and the original image is lost.

Now if I do the command
convert original_image.tga -alpha off -alpha on final.psd
I get the following
http://www.freeimagehosting.net/fd40e

Which, as can be seen, I have preserved my rgb image but lost the alpha channel.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving converted images without applying the alpha layer

Post by fmw42 »

can you post a link to your input image, not the screen snap, so others can test with it.

It would appear that IM is applying the alpha channel into background transparency in the PSD conversion and keeping the alpha channel.

I would note that IM's PSD and TIFF transparency processing has a number of known bugs and issues with dealing with both background and alpha transparency.
psycosyd
Posts: 5
Joined: 2011-08-29T09:38:24-07:00
Authentication code: 8675308

Re: Saving converted images without applying the alpha layer

Post by psycosyd »

here it is, a tga for my initial test

http://myfreefilehosting.com/f/4aeddee0ec_0.44MB

EDIT: For reference, I am using the most recent version of IM, 6.7.1.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving converted images without applying the alpha layer

Post by fmw42 »

psycosyd wrote:here it is, a tga for my initial test

http://myfreefilehosting.com/f/4aeddee0ec_0.44MB

EDIT: For reference, I am using the most recent version of IM, 6.7.1.

I get your same result when going to PSD. The alpha channel is both converted to background transparency and kept as an alpha channel.

However, it seems to work correctly when going to TIFF and viewing in my old PS CS.

convert jedisquirrels.tga jedisquirrels.tiff
psycosyd
Posts: 5
Joined: 2011-08-29T09:38:24-07:00
Authentication code: 8675308

Re: Saving converted images without applying the alpha layer

Post by psycosyd »

Yeah, I get that result as well, but I really need it as PSD... so it may be that IM is not going to be my solution this time. That would be too bad too.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving converted images without applying the alpha layer

Post by fmw42 »

You could try using EXIFTOOL to edit the psd file to tell it that it does not have background transparency. I was going to try that, but it looks like my exiftool install is corrupt and I will have to reinstall first before I can test that.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving converted images without applying the alpha layer

Post by fmw42 »

Perhaps you should report this on the Bugs forum.
Post Reply