Create .png file with transparency?

I'd like to create an image on the server side, and save it as a .png file, and set the transparency. Is there some sample code or an article that would tell me how to get started? Thanks.

com.sun.media.jai.codec.PNGEncodeParam.Palette
* void setPaletteTransparency(byte[] alpha)
sets the alpha values associated with each palette entry. The alpha parameter should have as many entries as there are RGB triples in the palette.
* byte[] getPaletteTransparency()
returns the alpha values associated with each palette entry.
     API: com.sun.media.jai.codec.PNGEncodeParam.Gray
* void setTransparentGray(int transparentGray)
sets the gray value to be used to denote transparency. Setting this attribute will cause the alpha channel of the input image to be ignored.
* int getTransparentGray()
returns the gray value to be used to denote transparency.
     API: com.sun.media.jai.codec.PNGEncodeParam.RGB
* void setTransparentRGB(int[] transparentRGB)
sets the RGB value to be used to denote transparency. Setting this attribute will cause the alpha channel of the input image to be ignored.
* int[] getTransparentRGB()
returns the RGB value to be used to denote transparency.

Similar Messages

  • Png files with transparent background show black only in firefox for android

    I have a wix created site and png files with transparent backgrounds are showing with a black blackground in Firefox for Android. They show transparent in all other browsers I have tried.
    I have tried saving the file as a gif, as a smaller png, interlaced, not interlaced, png 8, png24. It still shows black in Firefox for Android.

    Hi evelswoman,
    Thank you for your question. This sounds like a good one for the web compatibility team. Currently there are some compatibility documentation for background-image here: [https://developer.mozilla.org/en-US/docs/Web/CSS/background-image] and more details on background: [https://developer.mozilla.org/en-US/docs/Web/CSS/background]
    Filling a bug with webcompat.com with an example url can go a long way as well, I hope this helps.

  • Placing a PNG file with transparency

    If I have a psd / Png file on Photoshop that has text with no background (transparent), and I do a Place of that file into Illustrator, I get a white background in additiotion to the Text.
    How do I stop the white background from placing withing the Illustrator? I have Illustrator CS3 and Photoshop CS3
    Thanks in advance.
    Bob

    Half a decade later, I am getting the same problem as the original poster   (although I am using Illustrator CC 64bit on Windows 8).
    I am trying to 'place' a PNG graphic in Illustrator, The PNG has a transparent background, which is being honoured fine in other programs (e.g. web browsers - even in its icon in Windows Explorer).
    However when I place it in Illustrator, the transparency doesn't work: instead the background is displayed as an opaque colour. It stays that way if I output to a PDF from Illustrator.
    The PNG in question is a 'paletted' type (I think it has a palette of 256 colours) - one of which is set to be transparent.
    Does Adobe Illustrator not support transparency in paletted PNG files?
    (I'm aware that you can generate a 24-bit PNG with the transparency done as an 'alpha channel'), but this is wasteful for many simple types of graphic, creating a much bigger PNG file size.

  • Using PNG files with transparent background - Please Help

    I just purchased Elements to do a very specific task which I can’t do in Aperture. I am a former photoshopper (V.5) and excited to be back.
    I am doing a book/scrapbook and the majority of my text will be my own handwriting. I use white paper and black ink and I scan in at the highest settings. My goal is to create my handwriting on a transparent background so I can place it in my book as I choose. For this specific project (which is very large in scope) I wanted to keep my image/file management within Aperture.
    So I import my file (of my handwriting) from Aperture and successfully saved with a transparent background. Adobe said I had to save it as a PNG file. I noticed when I saved in Photoshop there was a warning saying I had to save as a copy.
    Aperture does not see the file when I try to import it back. My interchange between aperture and photoshop is fine otherwise. This problem only seems to be with “unflattened” layered images. When I flatten the image it is recognized by Aperture, but I lose the transparent background in Photoshop.
    If anyone sees flaws here or has a suggestion to “isolate” and save my personal handwriting image files I would greatly appreciate it. Thanks!

    Would probably work best if you first export from Aperture as PSD (if possible, like Lightroom) and then save to preserve layers.
    From the PSD save as PNG24 rather than PNG8 which is better for preserving transparency.

  • Saving PNG file with transparency

    Hello!
    In my application I generate "BufferedImage"s with transparent pixels. When I try to write them using ImageIO.write() in PNG format, the transparency information is lost.
    Can anybody send me working code for this problem?
    Thanks,
    Norbi

    What are you using to view the PNG? Are you sure it is a viewer that supports PNG transparency? Internet Explorer and the previewer built into Windows do not fully support PNG transparency so maybe that's the problem. See http://entropymine.com/jason/testbed/pngtrans/ for more info. I know for a fact the following code will generate a transparent PNG. Photoshop will read the transparency correctly but IE won't.
        public static final void main(String[] args) {
            // Create a new image with an alpha channel
            BufferedImage image = new BufferedImage(100,100,BufferedImage.TYPE_INT_ARGB);
            // Get a Graphics2D object that interfaces to the Image
            Graphics2D g2 = image.createGraphics();
            // Draw a red circle on the image
            g2.setColor(Color.RED);
            g2.fillOval(0,0,100,100);
            try {
                // Write the image to a PNG file,
                //  the red circle will have a transparent background
                ImageIO.write(image, "png", new File(args[0]));
            } catch (IOException e) {
                e.printStackTrace();
        }Anyone know how to do the equivalent with Jimi? This:Jimi.putImage("image/png", image, args[0]); only writes the PNG with a black opaque background.

  • Png Files with transparency

    I'm wanting to use iPhoto to organize my scrapbooking graphics. Problem is that the majority are png with transparency. When I imported them, all of the transparent portions of the images appeared in black, so many of them just look like black squares, because it's a black image on transparent background.
    Is there any way to get the png to look normal or is this a flaw in iPhoto. Does iPhoto 6 fix this problem?
    Thanks.
    Rayne

    After doing a little more investigating, I realized that iPhoto is generating the thumbnails in jpg, therefore creating a non-transparent thumbnail. When the image is viewed full size, it appears fine. So it's just the thumbnail that is causing the problem.
    Is there a way to get it to generate thumbnails so that the transparent portions get filled with white instead of black? I use a white background in iPhoto so this would make them appear transparent. Or at least I'd be able to see the transparent portions better regardless of which background I use.
    Thanks.

  • I created a photo book in Photoshop elements 11 that contains png files with the invisible backgrounds.  When I export the book to a jpg or a pdf, the png files appear with white backgrounds.

    I created a photo book in Photoshop elements 11 that contains png files with the invisible backgrounds.  When I export the book to a jpg or a pdf, the png files appear with white backgrounds.  Any suggestions on how to fix this? 

    jpg and pdf formats don't support transparency. You need to use a format such as tif, png or psd that does.
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Automator or Applescript using png files with alpha channel

    I have hundred of png files with alpha channel.
    I want to suppress alpha channel.
    How can i do it using Automator or Applescript ?
    Thank you very much.

    You can use the free command line image processing tool ImageMagick in your Applescripts or Automator workflows, as well as from a Terminal shell.
    You can download ImageMagick from http://www.imagemagick.org, but Cactuslab has simplified installation by putting together an installer package. It’s available at  http://cactuslab.com/imagemagick/. Download the package and double-click on it. Follow the instructions to install. It will install ImageMagick into /opt/ImageMagick and add it to your $PATH by creating a file in /etc/paths.d/. Restart your computer for the changes to take effect.
    The two ImageMagick commands we’re concerned with are “convert” and “mogrify”. Convert is more efficient for multiple and piped operations on the same image file, and mogrify is more efficient for batch processing. Generally speaking, convert will output a file separate from the input file. Unless a path is specified, mogrify will overwrite the input file with the output file. An important distinction.
    You can perform various operations on the alpha channel using arguments after either the convert or mogrify command. Two of the available arguments are:
    -alpha off - Disables the image's transparency channel. Does not delete or change the existing data, just turns off the use of that data.
    -alpha remove - Composite the image over the background color.
    Also of use are the -flatten and -background options:
    -flatten - overlay all the image layers into a final image and may be used to underlay an opaque color to remove transparency from an image.
    -background - sets the background color.
    Start off using the convert command with a single image to see the effect and adjust to your liking. Once you’ve achieved the desired outcome, then use the mogrify command to batch process the chosen images.
    Before getting into how to use Automator or Applescript in your workflow, use Terminal and the command line to see the effect on a single image. Copy one image to your ~/Desktop. In Terminal change the directory to ~/Desktop by typing the following command and pressing the Enter key:
    cd ~/Desktop
    Then choose the option you are looking for, -alpha remove for instance, type the following command and press the Enter key:
    convert input-photo.png -alpha remove output-photo.png
    You can check the alpha channel (transparency) and background in the Preview app, go View > Show Image Background from the menu bar.
    Once you’re ready to batch proces, place all the photos you want to convert with the same command into one folder. Copy the folder to your ~/Desktop. Let’s assume you’ve labeled the folder “InPhotos”. It’s prudent to manipulate copies in case something goes amiss. In that event you can copy the folder with the originals again and start over. Create a new empty folder on your ~/Desktop and call it “OutPhotos”. Let’s also assume your home directory is called “Me”. The following command will process the photos from the InPhotos folder and put them in the OutPhotos folder:
    mogrify -alpha remove -path /Users/me/Desktop/OutPhotos/ /Users/me/Desktop/InPhotos/*png
    According to Apple Technical Note TN2065:
    "when you use just a command name instead of a complete path, the shell uses a list of directories (known as your PATH) to try and find the complete path to the command. For security and portability reasons, do shell script ignores the configuration files that an interactive shell would read"
    So, you need to use the full path to to ImageMagick commands, unlike in the shell where you can just use the command name.
    To batch process using Automator, use the “Run Shell Script” action (note: retain the single space at the beginning of the last line):
    /opt/ImageMagick/bin/mogrify \
    -alpha remove \
    -path /Users/Me/Desktop/OutPhotos/ \
    /Users/Me/Desktop/InPhotos/*png
    To batch process using Script Editor (Applescript), use the “do shell script” command:
    do shell script "/opt/ImageMagick/bin/mogrify -alpha remove -path /Users/pd/Desktop/OutPhotos/ /Users/pd/Desktop/InPhotos/*png"
    Further info on ImageMagick:
    http://www.imagemagick.org/script/command-line-options.php#alpha
    http://www.imagemagick.org/Usage/masking/#remove
    http://www.imagemagick.org/index.php
    http://www.imagemagick.org/script/command-line-tools.php
    http://www.imagemagick.org/script/command-line-options.php
    Examples:
    The original PNG image:
    -alpha off:
    -alpha remove:
    -background black -flatten:
    -background blue -flatten:
    -channel alpha -evaluate Divide 2:
    -channel alpha -evaluate Divide 2 -background black -flatten:

  • Importing .psd file with transparency in Premiere Pro CS4 titler

    I am trying to import a psd file with transparency into the Premiere Pro CS4 titler and the transparency will not come in. I've tried psd, png, jpeg, gif, targa and none will preserve the transparency. What I'm trying to do is create a custom lower third using a image without having to build it inside the titler or drop the PSD directly onto my timeline. This seems like an easy task, but I'm not having any luck. Please help!

    Boy you guys are quick. I did not find this thread until after you'd sorted it out. You know how much I like to work on PS to PrPro problems!
    Jeff,
    You might want to move this thread to the PrPro sub-forum, as it will likely help others with PSD Transparency issues, and might never get seen back here.
    Like you haven't been busy doing the housekeeping already. You moved one post WHILE I was replying to it. Imagine my surprise, when I replied and ended up in the other sub-forum - as if by magic!
    Hunt

  • Get 'Generic Error' when attempting to import .mov files with transparency?

    I get the 'Generic Error' when attempting to import .mov files with transparency? I'm trying to use mattes with an alpha channel but I cannot import them. I have had this same issue since cs6, now I have it with cc 2014? Any clues would be most appreciated.
    I have uninstalled the DVCPro Codec, but it didn't help.
    I have tried converting the .mov file (which is now automatic in Yosemite) and this creates a ProRes4444 Codec, Again no luck with import.
    I've seen this issue on the web, but never a solution? Anyone?

    Hi Terence,
    I tried iPhoto Library Manager but it could not solve my problem. Opening the iPhoto library I can see that the reference to the pictures are pointing to my old location not to the new one. I considered running a script that would change all pointers since this is basically what is needed (in my case from /Volumes/RAID1/Fotos/XXX to /Volumes/Fotos/XXX). Instead I inserted a soft unix link to make to connection but that did not work. It is referring to the airport disk by the airport name rather than the mounted disk name. Very strange indeed. The problem is maybe not in iPhoto but in OSX? Anyway, maybe the only way out is to take some hours and manually run through all linked photos... cumbersome and annoying!
    Regards,
    Søren

  • How can I export a file with transparent background?

    Hi all,
    I know InDesign doesn't allow to export a PNG file, but I need my file to be in image file format with transparent background.
    I'm still learning so I am stuck here. How can I export a file with transparent background?

    If you can't get the PNG file export to work, you can export a pdf and open it in Photoshop, from there you can save it as whatever you like.

  • How do i move a picture from one pdf-file to another already created pdf-file with adobe reader?

    How do I move a picture from one pdf-file to another, already created pdf-file, with adobe reader?

    Reader doesn't have editing capabilities.

  • I place a psd file with transparent background on another layer in my InDesign document. The layer b

    I placed a psd file with transparent background on another layer in my InDesign document. The layer below has a color (RGB). When the psd file is placed it changes the color on the layer below. I've tried other psd files thinking something is wrong with my file, but get the same result. I have tried for days to figure this out. Can anyone help me?

    Wow, thank you! That was fast. I googled that question to death and even bought (another) book on CS5 and never saw that answer. Thank you so much. You made a very good ending to my day! I'd buy you a beer if I could!!

  • Creating XML files with the DME

    Hi All,
    I'm working on an integration project between my company and HSBC, they are requesting that we supply our AP payment files for foreign currency in XML format.
    I have some limited experience with the DME and know it can create XML files, however, the elements available for XML files are different to standard flat files. Also it doesnt seem like I can create files with multiple levels? e.g.
    <InitgPty>
    ......... <Id>
    ............... <OrgId>
    ...................... <BkPtyId>ABC00103003</BkPtyId>
    .............. </OrgId>
    ........ </Id>
    </InitgPty>
    Does anyone have any documentation or experience with creating XML files with DME?
    thanks
    Phil.

    Hi,
    Please ask any Implementation team in ABAB or Report painter team with your friends,
    Thanks and REgards
    N.Soma Sundaram

  • Creating a file with  content conversion

    Hi all,
    I have a scenario in XI which i create a file in it,
    I want to create the file with the content conversion option but with no field separator.
    I have an error message - "File adapter receiver channel is not initialized. Unable to proceed: null" if i don't use the fieldSeperator option.
    I don't want to use this option, I want the file to be created without separators.
    Thanks,
    Naama

    Hi Namma,
    Go through very imp blogs:
    File Content prameters for the Receiver Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    File Content prameters for the Sender Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Refer
    File Receiver with Content Conversion
    File Receiver with Content Conversion
    Configuring the Receiver File/FTP Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/frameset.htm
    File content conversion sites:
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Introduction to simple (File-XI-File)scenario and complete walk through for starters(Part2)
    File Receiver with Content Conversion
    Content Conversion (Pattern/Random content in input file)
    NAB the TAB (File Adapter)
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Introduction to simple (File-XI-File)scenario and complete walk through for starters(Part2)
    How to send a flat file with various field lengths and variable substructures to XI 3.0
    Content Conversion (Pattern/Random content in input file)
    NAB the TAB (File Adapter)
    File Content Conversion for Unequal Number of Columns
    Content Conversion ( The Key Field Problem )
    The specified item was not found.
    File Receiver with Content Conversion
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
    Please see the below links for file content conversion..
    The specified item was not found. - FCC
    The specified item was not found. - FCC
    File Content Conversion for Unequal Number of Columns
    File Content Conversion for Unequal Number of Columns - FCC
    Content Conversion (Pattern/Random content in input file)
    Content Conversion (Pattern/Random content in input file) - FCC
    XI Configuration for MDM Integration - Sample Scenario - FCC - MDM
    Thanks,
    Satya Kumar

Maybe you are looking for