Problem with alpha of pixels

Hi, i've a little problem, i've a method that get the pixels of an bufferedimage and set they to black or white values. My problem is only with the PNG files, i don't succeed to remove the transparence and when i show the image into my panel the black part is not completely black but there's still a transparence.
My bufferedimage's name is "sorgente" and this is the code of method.
<CODE>
boolean test_image (){
int w = sorgente.getWidth();
int h = sorgente.getHeight();
int[] rgbs = new int[w*h];
String ttmp = "";
int w_img = sorgente.getWidth();
int h_img = sorgente.getHeight();
int pixelCache, r, g, b, alpha;
for (int i = 0; i < w_img; i ++){
for (int j = 0; j < h_img; j ++){
pixelCache = sorgente.getRGB(i, j);
     r = (pixelCache >> 16) & 0xff;          
     g = (pixelCache >> 8) & 0xff;               
b = pixelCache & 0xff;
alpha = (pixelCache >> 24) & 0xff;
if (!((r == g) && (g == b)))
return false;
if ((r != 255) || (r != 0)){
if (r < 160){
sorgente.setRGB(i, j, 0x00000000);
} else {
sorgente.setRGB(i, j, 0xffffffff);
return true;
</CODE>
THANKS

sorgente.setRGB(i, j, 0x00000000); sets the alpha channel to transparent. Try setting the color to 0xFF000000

Similar Messages

  • Problems with stuck/dead pixels, battery life, ICS, and other problems

    Stuck/Dead Pixels:
    I bought my Droid Razr at around the 21st of December last year. On or around Christmas, I found a bright red pixel on the very bottom of my screen. Unlucky for me, I was leaving for Florida on Christmas Night. I got back on December 31st. Sometime in the first week of this year, I visited my verizon store and told the customer service lady that I had a dead pixel on my screen and had just bought it. But, she told me that she needed the manager to fix this and there was no manager there. For the next week I was busy with school and sports etc and was not able to go back to the store. It was now past my 14 day return period. So I decided, its only one pixel, most people won't notice it anyway. So here I am 5 months later, just starting to discover more pixels dying on my screen. I now have the one bright red one, two light blue ones, and one dark red. I have no idea what the return policy is on defective phones, and the verizon site is designed so that you can't find anything. And an FYI, I have tried stuck pixel removers and other apps, which  haven't been successful.
    Battery Life:
    I have also been finding more problems with my phone. The battery life is terrible when 4G and even 3G are on. I actually see no difference in battery consumption between 3G/4G.  My battery dies  about 4-5X faster when data is turned on, compared to using no data. I know it isn't because of the apps I installed since when I use WiFi, the battery is alright. I also make sure that my RAM isn't above 400MB, so that the processor doesn't use a lot of battery. I feel like I completely wasted my money buying the Razr. Mainly because of the fact that the Razr Maxx was announced two weeks later, which has about 80% more battery. Not only this, but I've seen the Razr selling for only ONE PENNY on amazon over the past month and it still is. I payed $300 on my Razr.
    Ice Cream Sandwich:
    After these major problems comes another one, that I bet all Razr and Razr Maxx customers are still thinking about. When will I get Ice Cream Sandwich? It is very disappointing when you are told that you will be getting an upgrade in early 2012, and are still wondering where your upgrade is 5 full months in. From what I understand, we won't see an upgrade until the end of June, since Motorola has posted on their website that "rollouts" would begin in the second quarter. Even if they release it by the end of June, when will it get to your phone? Maybe another week or two for some people. This is another thing that I feel I wasted my money on. My brother told me to get the Nexus because of ICS, but I trusted Motorola that they would upgrade my phone in a timely manner. WRONG.
    Phone Freezing:
    One more problem that I've had is that the phone will freeze. Usually you only need to turn the screen off and on, but once in a while, you have to completely reboot your phone. When I was coming back from Florida, right as I was about to get home, my phone completely froze. I was about to go return it, but after about 15-20 minutes, it became unfrozen.
    Motion Sensor not functioning:
    Another problem, an annoying one, is that sometimes the motion sensor that controls portrait and landscape mode will just stop working. Some of the games I play are completely dependent on the motion sensor. It is very embarrassing  when you are trying to show off to an iPhone friend and major components of your phone aren't working. They always tell me "why didn't you get an iPhone?". And I really just wanted to have a phone that didn't look like everyone else's, but I guess that comes at a cost. When the motion sensor stops working, I have to shut down my phone and restart, which takes a couple minutes.
    Problems with camera:
    My last problem would be with the camera. Sometimes if you bring the camera close to something, like a barcode, it will keep trying to focus, but never will. Another problem is photo quality in low light situations. It seems like the camera can't focus because it goes from being very dark into being bright because of the flash. I doubt this can be fixed because it's hardware, but a potential fix could be having the option to keep the LED light on during picture mode, that way the camera will be able to focus correctly.
    In Conclusion:
    I really just want someone to tell me how to return my phone for a new one, due to the dead pixels. I also wish I could be upgraded to the Razr Maxx because of the poor battery life on the Razr, but from what other people are saying, that probably won't happen. And finally, if anyone has more info about Ice Cream Sandwich, that would be awesome.

    Well since it's a Manufacturing Error it should Fall under your Warranty if you got one with your Razr. You know you can Call C.S. an they can Assist you with the Matter on it.. Just remember to have another phone so they can Trouble shoot the One that is Experiencing the Issue an when you talk to them go over thing. An they should send you C.G.A.N unless they request you to send it in before you get anther one. If you feel Better going to the Store try that. And Good Luck.. 

  • Question: Quick Look in Finder; problems with alpha channels

    Hi
    "Quick look" in Finder is great for quick presentations of a folders selected contents but it only works with images that contains no alpha channels or masks. Is there any way to work around this to display say PhotoShop documents with alpha channels? Or any plug-ins/applications that can help?
    thanks.

    This has been broken forever in OS X, and I don't know why, because it used to work just fine. I suspect the engineers did something to QuickTime that causes this problem, but it has been borked for so long I don't remember when the ability to correctly display files went wrong. I just remember that once upon a time all sorts of things from Apple worked correctly in displaying such files, but pretty much nothing does now. This includes the Finder, Preview, QuickLook, and various third-party image browsers that use Apple's own system level image handling abilities, such as VitaminSee or CocoaViewX. When I need to actually see what's there, I browse with Adobe's Bridge.
    Francine
    Francine
    Schwieder

  • Adobe Photoshop CC, problem with color noise/pixelation on the monitor display

    After downloading Adobe Photoshop CC, my images come in with color noise/pixelation on the monitor display. I've tried checking the color space preferences, but this doesn't help. I didn't have this problem before. Is there anything else I can check? There's no problem with LR, just Photoshop.

    My performance settings are: Available RAM 10905 MB/using 7633 MG (70 percent); cache levels 4, history 20, cache tile size 1024K. However, I noticed under Graphics processer settings, it is set on Advanced Drawing Mode - perhaps this should be changed to Normal or Basic Mode? Your help is very much appreciated.

  • Problem with Alpha Channel

    The top level track on my project contains an alpha channel. However, being the top level track the tracks below it are invisible.
    I have read the "Compositing, alpha channels, and adjusting clip opacity" page. It tells me that I "can choose how to interpret the alpha channel in a file in the Interpret Footage dialog box. Choose Invert Alpha Channel to swap areas of opacity with areas of transparency, or choose Ignore Alpha Channel to not use the alpha channel information at all."
    However, when I do this (ie. inverse the alpha channel in the asset) I get the following before and after results:
    Summary of goal: I want to adjust the transparency of the top track so that the lower tracks appear.
    Help.

    If you want to adjust the transparency of a clip, you modify its Opacity property.
    Changing the alpha channel properties in the Interpret Footage settings is for when the alpha channel of an asset is not being interpreted/used correctly by the application.

  • Texture problem with alpha channel

    [code]
    on createMySphere
    sr= p3d.newModelResource("mySphere01", #sphere)
    s = p3d.newModel("s", sr)
    s.transform.position = vector (0,0,0)
    s.shader = p3d.newShader("sShdr2", #standard)
    txS= p3d.newTexture("txS", #fromcastmember, member("image"))
    s.shader.textureList[1] = txS
    sr.radius = 100
    sr.resolution =60
    end
    [code]
    im using png image format for textures, because i want to
    make user to its alpha channel. The problem comes when the image
    has the alpha, The sphere disappears no matter how the alpha is
    painted.
    how do i make use of the alpha channel, it doesn't even have
    to be in the same image.

    thanks i used #both on my sphere it shows up but i dont see
    the image only black the other side.
    i used it on my plane and the texture is gone.
    on createPlane
    planeR = p3d.newModelResource("plane01", #plane)
    planeO = p3d.newModel("planeO", planeR)
    planeO.transform.position = vector (0,0,0)
    p3d.model("planeO").visibility = #both
    planeO.shader = p3d.newShader("pShdr", #standard)
    txPlaneO = p3d.newTexture("txPlaneO", #fromcastmember,
    member("Asphalt10"))
    planeO.shader.textureList[1] = txPlaneO
    planeR.width = 5000.0
    planeR.length = 5000.0
    planeO.rotate (90, 90, 0)
    end createPlane

  • Problems with alpha

    imported a alpha with white background made background transparent by useing modify - multiply but the image is very transparent how can i make it look solid any suggestions welcome

    >imported a alpha with white background
    Imported an alpha, what?   Animation?  Still image?
    If it's a still image, open it in Photoshop and remove the white background, then save it in one of the formats that supports background transparency like TIFF, PSD or PNG.
    -DH

  • Problem with aLpha channel export to quicktime

    Hi! after hours of trying this here is my last hope:
    I masked an imported qt-movie with chroma key a person in FCE 4. That was fine. But when I export Quicktime (million+, without compressor, etc.) there is no alphachannel anymore. I need that for the web (FLV). I f I export FLV FCE freezes at 0%.
    I am shure out there is somebody who has an idea. Pleaes

    Do not render the contents of the sequence. If you render, the sequence is exported using the render files. With the sequence unrendered export using the Animation codec with colors set to millions+.

  • Problems with line weight below 1pt

    In Illustrator CS6, when I draw a horizontal line, either with the pen tool or the line tool, the line weight cannot be set below 1pt.  If I draw the line at an angle, I can set the line weight to be smaller than 1pt.  If I change the position of this line from diagonal to horizontal, then the line weight snaps back to 1pt.  Does anyone have any idea why this happening or how to fix it? Thank you!

    Look for align to pixel grid
    Illustrator: Problems with Align to pixel grid

  • Problem with Triple Exponential Smoothing in HANA

    Dear All,
    I have a problem with one of PAL procedures!
    Currently, I am using FORECASTSMOOTHING with Triple Exponential Smoothing from SAP HANA Predictive Analysis Library (PAL). I am working with hourly data and I am testing this procedure only on 6445 records.
    I have a problem with cycle parameter that I can't overcome...
    When the cycle parameter is setted to 24 (hourly data) I can use only 4267 records from my input table. Even one record more generates error: “Could not execute 'CALL _SYS_AFL.PAL_TSF_TMH(TMH.INPUT_DATA_TS_F, "#PAL_CONTROL_TBL_TS", TMH.PAL_OUT_TS_F, ...' in 383 ms 461 µs . SAP DBTech JDBC: [2048]: column store error: search table error:  [2620] _SYS_AFL.AFLPAL:FORECASTSMOOTHING: [135] (range 2) AFLFunctionFatal exception: PAL error[73001502]:Ahead exception throw out, Check trace for details”.
    But when I change cycle to 5 or less I can use as many records as I want. Have you ever had such problem? I hope you could help.
    Regards,
    Wiola

    Hi Arvind,
    in my PAL code i don't let HANA to presume the time interval, like you said I just sorted rows in my table and I defined cycle (24).
    Strange is that my code perfectly works with less than 4267  rows.
    Maybe there is some problem with alpha, beta and gamma parameters optimization with more data... but I don't know how to manage it.
    This problem only occurs when I try to use Forecast Smoothing with large amount of data, in other algorithms like Double Exponential Smoothing or Triple Exponential Smoothing everything works well. Major difference between this algorithms is alpha, beta and gamma parameters optimization. Only in Forecast Smoothing they are optimized.
    Kind regards,
    Wiola

  • Alpha channel problem with Pixel Bender blendShaders

    I'm using Pixel Blender to try and create a blend shader for a Flex 4.0 app.
    It looks like this:
    <languageVersion : 1.0;>
    kernel PixelReverse
    <   namespace : "com.abc.def.filters";
        vendor : "EdAlive";
        version : 1;
    >
        input image4 foreground;
        input image4 background;
        output pixel4 dst;
        void
        evaluatePixel()
            pixel4 fgPixel = sampleNearest(foreground, outCoord());
            pixel4 bgPixel = sampleNearest(background, outCoord());
            if((bgPixel.r == 0.0) && (bgPixel.g == 0.0) && (bgPixel.b == 0.0) && (bgPixel.a == 0.0)){
                bgPixel.r = bgPixel.g = bgPixel.b = 1.0;
            dst.r = 1.0 - abs(fgPixel.r - bgPixel.r);
            dst.g = 1.0 - abs(fgPixel.g - bgPixel.g);
            dst.b = 1.0 - abs(fgPixel.b - bgPixel.b);
            dst.a = fgPixel.a;
    It looks correct in the Pixel Bender preview window.
    When I use it in a Flex project with proper 32 bit png images, the filter seems to work correctly, except it sets any partial alpha value on the images to fully opaque (like a 1 bit alpha channel).
    Because the image preview looks correct in Pixel Bender, I'm assuming it's a problem with the bitmap data that Flex is passing to the blend shader filter.
    I tried changing the filter to simply output a copy of the foreground firstly, and the background second, to test.
    When returning a copy of the foreground, the imags weren't visible on stage, either because the pixels were transparent or because it was really returning the background pixels, camouflaging the images.
    When returning a copy of the background, the images were just black rectangles.
    The images are being place on stage programmatically inside an mx Module, and having their depth property set.
    They also have draggable behaviour, where the current drag object is layered above all else during the drag.
    I'm actually using a subclass of mx.controls.Image, but am simply setting the source property with preloaded bitmap data, so I'm am fairly sure the subclass is not a factor.
    I hope this is enough information for someone to be able to provide some help.
    Thanks

    Please make sure you have installed the latest graphics drivers, from http://www.nvidia.com/Download/index.aspx?lang=en-us, for your graphics card.

  • Problem with rendering RGB with alpha

    I have AE 6.5. I suddenly began having .AVI's with alpha channel rendering with a flickering background with numerous flashing colors.
    I did system restore, reinstalled 6.5 with no help.
    No new programs, not hooked to internet, using 2 gigs RAM with AMD athalon FX 53,Nvidia GeForce FX 5500.
    I tried several different projects which have previously worked and they do the same thing.
    Rendering as Video for Windows with no compression. RGB + Alpha
    Rendering with just RGB doesn't have the flickering, etc.
    Preview set to "off" in comp window.
    Any help would be greatly appreciated.
    Thanks in advance.
    John Rich

    > I have AE 6.5. I suddenly began having .AVI's with alpha channel rendering with a flickering background with numerous flashing colors.
    But when you composite these lcips I'll bet the alpha content is not really there.
    We used to have this problem with the Media 100 hardware codec when rendering form After Effects. The alpha channel was full of the creepiest stuff, frame buffers motion blur and effects from other compsand it was really there. Playing the clip back in Media 100 or in QT showed the alpha channel's bizarre content.
    However, if you turned off RGB and viewed alpha only, the stuff was gone, absolutely transparent. If you dropped the clip into a timeline, the alpha behaved normally.
    We never did figure it out, just lived with it.
    bogiesan

  • Problem with Pixel Bender

    Hi -  I am 85 years old and not very experienced with computer jargon etc. My problems with Pixel Benders only started after I recently had my Dell 64 bit computer upgraded. Previously it used Windows XP and had 4 gigs of RAM my graphics card had only 64 MB. HOWEVER, before the upgrade Pixel Bender filters worked perfectly, I have a folder in "My Pictures" that contains 65 images that have all been treated with a variety of P B filters, I am very pleased with the results. My software includes Photoshop CS5 also Lightroom 3.
    My upgrade, done by a professional technician, involved, wiping my internal hard drive completely (everything was backed up on two external hard drives)  the installation of Windows 7 - 64 bit and additional RAM (it now has 8 gigs) When it came to re installing the Pixel Benders it was a nightmare. I had to make several calls to Adobe technical support before it would download I even had to allow the technician to access my computer. The next problem was that the Pixel Benders would no work.  I looked at the Adobe Forum and found that others had experienced the same problem. One solution seemed to be to install a graphics card with more MB, I therefore bought a GeForce GTSD 250 that has 1 GB of RAM.  Whereas the 65 pictures in my Pixel Bender folder are 2000 pixels on the longest edge using my new system and graphics card the Pixel Bender filters will not work on any image that is more than 1000 pixels on the longest edge. Can anyone out there explain the reason for this?
    littlemester, Sheffield, England

    Please make sure you have installed the latest graphics drivers, from http://www.nvidia.com/Download/index.aspx?lang=en-us, for your graphics card.

  • Problems with Apple ProRes 4444 and alpha channels in Motion 4 after upgrade to Snow Leopard.  Has anyone seen this?

    We've just now upgraded from Leopard to Snow Leopard and are having a problem with Apple ProRes 4444 and alpha channels in Motion 4.  A clip with an alpha which keyed perfectly before the upgrade, now will not key.  If I convert the clip to the Animation codec, it keys perfectly.  If I export the Motion project as a ProRes 4444 self contained movie, it will key when brought into FCP 7 but if I import the project into FCP 7, it will show the key in the viewer but not the canvas.  Has anyone seen this or have any suggestions on how to correct this?  Is it a bug? 
    Thanks,

    Motion 4.0.3
    It just doesn't seem to recognize the alpha at all. 

  • Intersecting Layers with alpha problem

    Hi,
    I have a problem with Motion when two layers intersect. On layer is totally opaque, and the second layer has transparent areas. The problem occurs in areas when the transparent areas intersect with opaque areas. In those regions I get a dark gray line appearing.
    Check out this image and you will see what I mean.
    http://jack.fxhome.com/MotionLine.jpg
    Note: I get this unwanted line in the exported frame as well.
    Why does motion do this?
    Is there anyway around this?
    Thanks

    1) Try setting your Render Quality to Best (under the View pop-up menu)
    2) Try changing the alpha interpretation of the layer with transparency - select it, press Shift-F, and try the different options in the Inspector's Media tab.

Maybe you are looking for

  • Error while Accessing Smart Card using Open Card Frame Work

    HI Using Open Card Frame work I am trying to access GemAlto provided Smart Card (java card). I downloaded the Open Card Frame work from “http://www.openscdp.org/ocf/download.html”. I am executing a basic program to access the data stored in smart car

  • Error while making vendor rejection through 122 mvt

    Dear Friends, User made GR for a Subcontract Material against a Scheduling Agreement. Then part qty he wanted to reject through 122 mvt. System gives the following error. Purchase order 8101000081 00210 has no component 000ADC120000 in plant 1000 Mes

  • XI Scenarios (Views)

    Guys,  Need some u r views on below statements. 1) When i am using RFC Sender Adapter , i can only just give only static import paramters or else  i can  schedule it to background. So i understand that RFC Sender Adapter can be used when we want to u

  • How do I stop InDesign from crashing every time I open a certain file?

    I tried to move a 2 page spread to the beginning of a 52 page layout and InDesign crashed. I tried recovery and it would crash each time seconds after opening. I tried closing every thing, hard boot, then opening from the file. It opened fine then in

  • Formula Assistance for TIF Images

    I am seeking assistance to insert TIF images to a Crystal Report based on specific file path.  Specifically, I want to dynamically determine the file path based on the name of the TIF image.  The database structure allows me to determine the TIF file