Using Image as alpha layter

I'm reading an Image from a ByteArrayInputStream. This image is purely black-and-white, where the white parts of it should be transparent and the black parts should not. The problem is, the white parts are not transparent.
Is it possible to create an alpha mask from this image, where all white pixels are included in the mask, and then apply this alpha mask onto the original image (which is actually the same image, without being converted to an alpha mask), so only the black pixels are displayed?
Are there any alternative solution if this isn't possible? I'm a bit out of ideas myself at this point :/
(Sorry for the cross-post: http://forum.java.sun.com/thread.jsp?forum=5&thread=485556&tstart=0&trange=15)

This might help.
public static void makeTransparent(BufferedImage bImage, Color color) {
int markColor = color.getRGB() | 0xFF000000;
for (int y=0; y<bImage.getHeight(); y++ ) {
for (int x=0; x<bImage.getWidth(); x++ ) {
int col = bImage.getRGB(x,y);
if ( ( col | 0xFF000000 ) == markColor ) {
bImage.setRGB(x,y, 0x00FFFFFF & col); // Mark the alpha bits as zero - transparent
just do this:
(u have to have some Image image)
int w = image.getWidth(null);
int h = image.getHeight(null);
BufferedImage sBuf = new BufferedImage(w,h, BufferedImage.TYPE_INT_ARGB);
sBuf.getGraphics().drawImage(image, 0,0, null);
makeTransparent(sBuf, new Color(0,0,0)); // for black to transparent
voila.
did it help ?

Similar Messages

  • Animate Particles Using Image Source Alpha Mask - Outline

    I am trying to animate particles emitted from the outline of an alpha mask. I can get the emitter to see the mask, but only as a rectangular bounding box. How do I get the particles to be emitted from the organic shape within the mask? I created the alpha mask in Motion.

    Heya,
    I see what you're talking about: using the alpha for Fll or Random Fill seems to work fine, but using the alpha with Outline doesn't seem to work (except using the outline of the whole bounding box).
    Maybe a bug, though I would guess that generating an outline path from an alpha channel would be an expensive process, computing-wise. It makes sense if you have a relatively simple alpha with a single "blob" of solidity, but if you had a complex (noisy) alpha, it would be a royal pain to solve.
    Would be nice, though

  • Flash intro using images.. Please Help

    I am trying to create a flash intro like this one....
    http://www.mark-knopfler-news.co.uk/
    I am really new to flash and don't know much beyond making
    menus. I have looked at different tutorials, but I don't see
    anything about how to create an intro like this one.

    Miss_Angela wrote:
    > I am trying to create a flash intro like this one....
    >
    >
    http://www.mark-knopfler-news.co.uk/
    >
    > I am really new to flash and don't know much beyond
    making menus. I have
    > looked at different tutorials, but I don't see anything
    about how to create an
    > intro like this one.
    Check in help under the Tutorial section for "Add motion
    tweens"
    Basically you need to import your images, convert them to
    instances like
    movie clips or graphics symbols then motion tween them to get
    them move
    and use color effect Alpha to get them to fade in.
    Check the help first and tell me how far can you get from
    there, whatever
    problem you face, post back, will help you go ahead with it.
    Best Regards
    Urami
    Beauty is in the eye of the beer holder...
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • AIR Application Installer screen - name - How to use image??

    I want to use the image instead of the plain text for the name of the application. Is there any way to use image as an application name?
    PrincessWidget-app.xml
    <!-- Used as the filename for the application. Required. -->
    <filename>Princess Countdown Connection</filename>
    <!-- The name that is displayed in the AIR application installer.
    May have multiple values for each language. See samples or xsd schema file. Optional. -->
    <name>assets/Princess_logo.png</name>
    <!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
    <version>v1.0.1</version>

    thanks levi_h
    JTextPane class extends JEditPane and allows you to embed
    images or other components within the text managed by the component

  • Animated window mask using imaging lingo-

    Has anyone tried animating a window mask at runtime using
    imaging lingo? Does it work and is it smooth on at least a
    reasonable cross section of machines? I’m thinking something
    like the Media Player skins from
    http://www.theskinsfactory.com/skinsfactory/
    (specifically the Alienware Invader skin) … although frankly,
    even on my brand new duo that skin could animate smoother.

    I tried it as well once... the file can be downloaded here:
    http://www.chunick.com/director/animated_mask.zip
    for fun you might want to check out my window with alpha mask
    too:
    http://www.chunick.com/director/window_alpha_mask.zip
    * (Long) Note: the scrnXtra function ScreenToImage() that was
    added by Valentin Schmidt to the scrnXtra (and which is used in the
    example) has a memory leak in it so don't run the example too long.
    The function was added to the scrnXtra using the ScreenToFile()
    function as a quick workaround in the C++ code; so ScreenToFile()
    could probably be used instead to get the exact same effect without
    any memory leak. The ScreenToMember() cannot be used as it has a
    flaw because the TrimWhiteSpace() property of a member is enabled
    by default and the C++ code does not address this... so any white
    pixels on the border of the image will be trimmed and there's no
    way to tell which edge of the image they were trimmed from
    (AFAIK).

  • How to use images from ADFLib

    Hello OTN,
    My application is devided into several ADFLibs, one of them is CommonUI. It includes common skin and it is imported into every application part.
    There are some images which should be available in different parts, so I decided to put them in CommonUI.
    After deploying adflibCommonUI adn refreshing Resource Palette, somehow I expected to see this image there, but it isn't.
    Could someone, please, explain me, how to use images contained in imported ADFLib, for example, as imageLink icon?
    Thanks.
    ADF 11.1.2.1

    Hi,
    images need to be saved in a specific file structure in the JAR file to be accessible. See:
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/86-images-from-jar-427953.pdf
    Frank

  • How to Use Image Processor for Multiple Sizes

    I'm trying to use Image Processor to work on a folder of images and to create several sizes of .jpg's . I find an option to Save as JPEG in one size only. Is there any way to set up Image Processor to save JPEG to multiple sizes?
    Thanks in advance for your help!!!

    Hi Mehtap,
    Using the script will give you multiple selections.
    This is how I did it and it works well. It just separated the values by semicolon ";" .
    TEXT_1.setText(DS_1.getFilterText("0CUSTOMER"));
    When selected only one value:
    When selected more than one value:

  • Using Images in Spry Dropdown Menus??????

    I am in the middle of making a web site that needs a drop down menu for one of the top navigation menu buttons, when I designed the web site I created my  own buttons (images) in photo shop. When I went to create me navigation bar I tried to insert images in the spry menu bar, so that I can have my imaged and have the drop down menu but that didn't work, so then I tried to use a table and insert the images there and in the cell that needs the drop down bar I put in a spry menu bar but that through the whole navigation bar off. Can anyone help or does anyone know how to use images in spry drop down menus that can help me have the look I want and the drop down menu?

    Have a look here http://www.adobe.com/devnet/dreamweaver/articles/spry_widgets_design_04.html
    I hope it helps.
    Ben

  • Using "Image/Transform/Perspective" on a layer?

    Hi,
    I'm new at this.  I have a shot of a big room with empty art frames on the walls.  I have rectangular layers that are shots of paintings that I want to drop into the frames, but of course the paintings layers have to be skewed to show the perspective angle (trapezoid) that matches the room.  Problem is, it seems that I can only use Image/transform/perspective on the painting files before they become layers.  This means guessing the perspective, then moving them into the background, which is trial&error at best.  It's very hard to guess the appropriate perspective when the file isn't a layer. It seems that once the painting files become layers, the "perspective" option is no longer available.  I can use "skew," or "free transform," but not "perspective."    "Skew" doesn't work, because while it will allow changing the rectangle into a paralellogram, it won't allow me to change the rectangle into a trapezoid. "Free Transform" doesn't work for the same reason.  So, How do you apply the "perspective" function to a layer?
    If I knew how to change the rectangle by grabbing one of a selection's corner anchor boxes and fixing it place, that would help because I could create my own trapezoid, but I don't know how to do that.  Does anyone?
    Thanks!

    I've no idea why all the transform options aren't available; they are here.
    Anyway, try this:
    Drag or copy/paste the painting in. It will come in as a new layer.
    Convert that layer to a smart object (Layer > Smart Object > Convert..). Reduce the smart object opacity to 50%.
    Choose Transform > Distort and move the corners individually into place.
    When you're happy, set opacity back to 100% and rasterize the smart object.
    The beauty of the smart object in this case is that you can transform repeatedly without any additional quality loss; it will be rendered only once when you rasterize.

  • Error message when trying to use image processor in CS2

    Hi
    I am trying to use image processor to condense 500 proofs for my website - however although I have done many times before with no problem, now when I hit the Image processor button before I even get to key in details it is bringing up the sorry something major has happened message and I can't continue - the details of this message are as follows - ref error : this.dlgMain.ddset on Change is not a function :810 - does this mean anything to anyon? Any ideas on how to overcome would be much appreciated.
    thanks

    Go to Russell Brown's website and download his package for CS2. His 1-2-3 Processor is much more flexible than the one provided by Photoshop.

  • Why can I no longer import EDITED photo from my iPad to my Mac using Image Capture from Snapseed app?

    Why can I no longer import EDITED photo from my iPad to my Mac using Image Capture? This is farcical and a real problem having to email them individually to myself and is totally inefficient time wise compared to previously using image capture! Why change this when it was working well and very quickly until the latest change. Now I have to move files from downloads into an appropriate folder, after emailing each individual edited image to myself, then I have to open in Photoshop and rename the file. This is ludicrous and takes forever to do!

    Thank you! I suppected it would be in the settings somewhere. I' ve much to learn...get myself into trouble pushing buttons I don't really understand.

  • Is there a way to prevent ibooks author from shutting down after just one or two uses of the alpha tool?

    Is there a way to prevent ibooks author from shutting down after just one or two uses of the alpha tool?

    Hello One Job at a time,
    Deleting the application will not delete your projects.
    Normally I keep all my work files on a separate drive.
    If you command click on the title name of your project you will get a drop down path to show you the location of your book project.
    or you can click on the drop down triangle beside its name to duplicate.
    Just remember where you saved the file too.
    In your applications folder on your computer select the iBA icon and press delete and also erase / empty the trash can.
    You can then go back to the APP STORE and install iBA from new again.
    I hope this helps.
    Regards,
    Nigel

  • Why is the scan size of our epson 15Mb for PDF using image capture?

    Hi All-
    This has been plaguing us since Snow Leopard when we lost the Epson Scanner tool from Epson to Image Capture scanning using our Epson 835 Artisan.
    PDF sizes are ridiculous using Image Capture. 
    For example, 3 pages of text using Image Capture =
         15Mb
    Using the same printer, same 3 pages and the builtin Epson Scanner (from the printer panel) and a USB stick =
         1.2Mb
    This has been happening since the SL upgrade (as mentioned) but I had hoped that Epson/Apple could get their act together on the Epson drivers for ML.  Seems not to be the case.  It is kind of a drag to have a Network available Scanner only to have the built in software be a bum steer.  Not only that, but no relief from Epson since their Scanner program (as bad as it was UI wise, but at least you got a mail-able document) has been discontinued...
    Any ideas?
    jp

    This doesn't answer the question but it is a workaround.
    How is the quality if you do this:
    Open the PDF in Apple Preview
    Choose File/Export
    In Export, choose PDF format with the Quartz Filter option "Reduce File Size"
    If it's ugly, there's a way to adjust the compression settings by using Apple ColorSync Utility to make a modified copy of the Reduce File Size filter with different settings. By playing with this I was able to start with a 7.1MB PDF scan from Image Capture, and export variations based on different Reduce File Size settings:
    5.3MB (JPEG Max) - looks great
    188KB (JPEG Min) - looks good as the 5.3 MB copy actually
    40K (Automatic) - too blurry to be usable
    If you were to perfect your own compression filter you could just export each PDF through Preview after scanning it, or presumably you could build some kind of drag-and-drop conversion utility in Automator although I don't know anything about Automator.
    It's a workaround because I could not determine a way to apply a Quartz filter from Image Capture itself when saving a PDF.

  • Colour washed out when using image processor in Bridge CS6

    Hi there
    I hope somebody can help please?!
    I am editing raw files in Camera Raw 8.2, then using image processor through Bridge CS6 to save them as both jpegs and tiffs.
    I am finding the colour on the saved files is coming out a little washed out and faded.
    If I open them individually and save them in PS6 as jpeg and tiffs, the colour remains vibrant and true to the original raw file.
    I have thousands of these files to go through and don't have time to open each one individually in this way so I am desperate to automate this process while still retaining the great colour in the original shots.
    Can anyone tell me why the shots are coming out this way and help offer a solution for me please?
    Any advice would be massively appreciated!
    Many thanks
    Benny P

    Hi,
    Do you have Include ICC Profile checked at the bottom of the Image Processor dialog?

  • Any way to open new browser window without using image maps?

    Is there any way to open new browser window without using image maps? My code works fine in Firefox, but not in IE. There are 2 problems in IE: 1st is that the thumbnail images move up within their own borders & 2nd that when you click on an image it does open up a new browser window, but also redirects to the index page (in this case it's just a placeholder index page - the new one I've called index_new.html for the time being).
    Here is the link:
    http://www.susieharperdesigns.com/gallery_beads.html
    Any help is greatly appreciated.

    Your missing a value on the HREF.  In your code you have this:
    <area shape="rect" coords="-24,-9,106,144" href=" " onclick="MM_openBrWindow('gallery_bead1.html','','width=255,height=360')" />
    </map></div>
    and it should be this:
    <area shape="rect" coords="-24,-9,106,144" href="javascript:void()" onclick="MM_openBrWindow('gallery_bead1.html','','width=255,height=360')" />
    </map></div>
    If you fix the code on all your beads, it should work.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

Maybe you are looking for