• Contact Us 1.866.568.0129

wmf to jpg maintaining tranparency?

Last post 22 Aug 2005, 12:51 PM by Steve Hawley. 5 replies.
Sort Posts: Previous Next
  •  18 Aug 2005, 2:33 PM 7117

    wmf to jpg maintaining tranparency?

    Hi, I'm trying to write an application that converts WMF files with transparency, into a jpg with transparency.

    If i just load and save the wmf, all the transparency is converted to black.

    Is it something to do with the saving to jpeg?

    I'm saving the jpeg using JpegEncoder.Save().

    also, if I try saving to gif, the image is completely blank.

    What am i doing wrong?

    Thanks
  •  18 Aug 2005, 2:34 PM 7118 in reply to 7117

    RE: wmf to jpg maintaining tranparency?

    OK, just realised Jpeg doesn't support transparency (doh) but why doesn't converting to Gif work?
    And is there an easy way to specify what colour the aplha channel is converted to?

    Thanks
  •  18 Aug 2005, 2:43 PM 7119 in reply to 7117

    RE: wmf to jpg maintaining tranparency?

    OK, flattenAlphaCommand seems to work well (doh) so my only query is how to save a WMF with transparency as a Gif with transparency.
  •  20 Aug 2005, 12:27 AM 7120 in reply to 7117

    RE: wmf to jpg maintaining tranparency?

    I'm pretty sure ImgX doesn't support transparency in WMF files. You will have to assume a color (such as white) to be transparent.

  •  22 Aug 2005, 7:09 AM 7121 in reply to 7117

    RE: wmf to jpg maintaining tranparency?

    I'm using dotImage document imaging 2.1, which displays the wmf files with a transparent background (i.e. Control gray, same colour as the viewer).

    It's more the saving as gif that I can't get to support transparency.
  •  22 Aug 2005, 12:51 PM 7122 in reply to 7117

    RE: wmf to jpg maintaining tranparency?

    Things to be aware of:
    1. GIF is a palette-based format. That means that you can have up to 256 colors in the image total.
    2. GIF transparency is based on exactly one of those colors, and that transparency will be 100%

    To get this, translate your image to 8-bits per pixel indexed, which will give you a color map. Choose one color in the palette to be your transparent color, then change that palette entry it to be 100% transparent. Finally, save as GIF.

    The problem you will encounter is that in translating to 8bpp, your image will no doubt become dithered, which makes it hard to pick the right color for transparency. This is why programs like PhotoShop, give you a dialog box to let a human pick that color.

View as RSS news feed in XML
Powered by Olark