Load PNG Images and draw on them.

I have to load a png image in a JPanel and then draw on this image. How is the way to do it? I've tried several ways but I don't achieve nothing.

Hi,
Re:
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
...I guess the conclusion is even though you can use PL/SQL to get the
PNG images into the database - like we've done here. There is no real
point, because one cannot retieve them with standard Java Intermedia
calls.
<HR></BLOCKQUOTE>
On the contrary - I just grabbed a PNG image from our 9i test system, uploaded it using the photo album servlet demo to my 8.1.7 database (which doesn't 'do' PNG) and retrieved it using the same servlet. My Netscape came with the QuickTime Plugin, so the PNG image got displayed as would any other image.
OK, I admit I had to admit modify the demo a little, but it is just a sample after all, not a full-blown, production web application. For upload, all I had to do was trap the exception raised when it tries to create the thumb-nail. There were 2 changes for retrieval. For the thumb-nail page, if there isn't a thumb-nail, ie getContentLength() == 0, then it displays the text "[view image]" instead of the thumb0nail image. For the full-size page, it only generates the height and width tags if getHeight() and getWidth() both return non-0 values. I didn't have to modify the method that actually delivers the data at all. It just uses the BLOB, MIME type and content length (which you sent when you loaded the image, right?!). The height and width tags aren't required. They just speed things up if present, because the browser knows ahead of time how much space to reserve, so can keep rendering the page, rather than wait for the image to arrive.
Re:
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
Can't begin to explain how sad this makes me :(
<HR></BLOCKQUOTE>
Cheer up! :-)
Simon
null

Similar Messages

  • Load png image and save it

    I am loading a png file and saving it again with following code. The newly created image file is smaller size and poorer quality. How can I retain size and quality of the image?
    ===========================================
    File input = new File(imgFilePath+"img1.png");
    BufferedImage im = ImageIO.read(input);
    Graphics2D g = im.createGraphics();
    File output = new File(imgFilePath+"out2.png");
    ImageIO.write(im,"png",output);
    ===========================================

    Would a moderator please change this topic back to not solved.
    @Noel: I tried exactly what you said, copying the image to itself so the source and target would be the same size.  It does not work.  I do understand that you respond to many posts and can't actually try to reproduce every issue.   However, in this case, if you did try it on the posted image you would see that the problem is as I described it.
    @Acidiclnk: Thank you for reproducing the problem. Unfortunately, I checked your response as the correct answer, but now realize that it does not solve the problem. What you suggest shifts the position of the image from its as loaded position.  Then, as you said, copied images do register with the original.  The problem is, the shifted image no longer lines up with the other maps of my texture.
    It took me awhile to find the commands you described, as they are a bit different in my CS4 ("Align Layers to Selection > Vertical Centers", etc).  When I tried them, the pasted image was correctly registered with the original.  Unfortunately, as I mentioned, the image is no longer aligned with the other maps of the texture.
    For this particular case, since there were large, uniform areas in the image, I temporarily added fiducial marks to the problem image and one of the other maps.  Then, after copy/paste, I moved the shifted copy until it's fiducial was aligned with the other map, then removed the fiducals.  (I could not use MTSTUNER's Duplicate Layer suggestion, since duplicating it to a new image created a new image with the same problem as the original).
    To summarize: PhotoShop loads this image in one position, but aligning the centers or copy/paste moves it to another position.  I would be happy to know why this is so.  I did verfy that it's unique to PhotoShop as copy/paste works without the shift in another graphic editor.  Any insights would be welcome.

  • Load external images and video in edge

    Hi.
    I am looking into edge instead of flash.
    My question is how do you load external images and videos from an external server?
    To clarify, I need to insert a link from where the images can load into the stage, so they don´t take up any of the final weight.
    Thanks in advance.
    Best,
    Stig.

    The above solution I provided works if you already have the images in your composition and than if you want form load images from another server rather than the relative location to your html file.
    Now if you want to load images dynamically into a rectagle containter you will have to code it.
    below is a sample for that
    Create a 'rectangle' with name 'Rectagle'.
    Add the snippet in the compositon ready or on other user actiosn based on your requirement
    var myImagetag = '<img src="http://wwwimages.adobe.com/include/style/default/SiteHeader/logo-2x.png">'
    sym.$("Rectangle").append(myImagetag);

  • Can't load PNG images in CS3

    I'm unable to load PNG images using Photoshop CS3. Whenever I attempt to do so, I get a message saying, "Could not complete your request because it is not the right kind of document."
    Help on this matter would be much appreciated as I am fairly new to using Photoshop.

    I am thinking it is a png file from fireworks.

  • Loading PNG image file from Applet?

    Hi All,
    My applet running on IE6 and it will often loads 100 PNG image files from a webserver.
    Size of PNG file is about 60Kb so 100*60=6000 Kb ~ 6M.
    In theory, the applet will took 6M of memory to store all 100 files. In practical, it tooks about
    6M* 25 = 150M of memory, that make my applet run in out of memory sometimes.
    I know the reason, may be the brower/applet convert the PNG file format to BMP file format before showing on the screen.
    So the main point here is the applet should not loads all 100 files into the memory,
    it should loads only 10 files at the same time, another 90 files should be cached in memory as PNG file format, not BMP image file format to save the memory usage.
    Is this solution possible in applet field?
    If it is possible how can I implement it?
    And please show me better solution if anys.
    Many Thanks.

    I know the reason, may be the brower/applet convert the PNG file format to
    BMP file format before showing on the screen.This sounds VERY unlikely! Why should the browser do that? And the applet does what you have coded I hope!
    Your problem is probably somewhere else. And it has nothing to do with applets I presume. Use a heap analyzer tool to find out what hogs the memory. A thorough code review can't hurt either. If you still thinks it is the images though, then just don't load them all at once then.

  • Safari not loading all images and being weird

    When I logged on to Apple Discussions toady, I noticed that safari changed around the font and size of the websites I look at. At first, the text was huge, so I made it smaller (in the View menu), and then it became really small. Also, a lot of the images on web pages aren't loading (for instance, in my tool menu thingy on the right of this page, the icons for preferences, posts, and subscriptions wasn't loaded. They were replaced with blue boxes and white question marks. I can live with the issue, but it's annoying. Any suggestions? Thanks in advance.
    -Michael
    BTW - I have tried reseting Safari - no luck

    But Firefox, Camino, Omni Web and Opera do without contesting.
    One great thing about OS X is that there are several excellent browsers and there is no need to necessarily stay with Safari. I actually have 7 or 8 browsers installed, although I mostly use them for checking how pages are rendered, I also switch back and forth between them to learn their strengths and weaknesses and for a change of pace. I use Firefox and OmniWeb alot in addition to Safari. I like the way you can add functionality to Firefox using extensions. I like OmniWeb for doing research because of the way it handles tabs in its sidebar. Opera is also good and it is now free.
    So, don't feel that you have to use Apple's browser. Use the one that you like the best or works the best for you.

  • Load external image and animate?

    This may be a naive question, but -
    What is the best method to draw external content (an image
    file) into a Flash movie, AND then ANIMATE that content?
    I assumed I would need to use the LOADER COMPONENT to draw an
    image file from an external URL, but is there a way to then perform
    a simple animation (e.g., slide the image across the stage) with
    the loaded image? I cannot seem to figure out how to manipulate an
    image once loaded (using the LOADER COMPONENT).
    Yes, I am new to Flash, so there may be six other ways to do
    this of which I am not aware.
    Suggestions/solutions?

    use the MovieClipLoader class to load the image into a holder
    movie clip, then use the onLoadInit function to animate the holder
    clip.

  • Load external image and data in video?

    Hi, i'm a newby in After Effects.
    I have a question: is it possible to make one like this video?
    http://www.facebook-studio.com/gallery/submission/don-natale-1
    the first part isn't a problem, but the integration of selected index in the video.... is it possible to make with after effects? And how?
    i think that you can load xml file and define areas in video with after effects, but this is my opinion
    thankyou.
    see you

    If you are trying to recreate this video with AE then just import the various videos, scale them and animate their positions. Parent them to still images you're using as the backdrops.
    If you asking if AE can export XML data or import XML data to bring video's from another source into AE I have to ask what's the point. AE is a program for making videos. It's not a program for creating interactive presentations. For that you'll need to learn HTML 5 or Flash. AE is not at all designed to produce interactive presentations. It's to create visuals effects... It's not even the right tool to make a movie, but it's a great tool to make a great shot.

  • Issues loading png images in flex 4.

    For some reason in my application when I use specific PNG images they will not load.  They do not have a high dpi, nor are they very large.  For example : will not load in an mx:Image component, but will.  Does anyone have any idea what the difference between the two would be?
    the mxml I'm using is something like <mx:Image source ="IMG/imagename.png"/> where IMG is a folder in the main directory.  Both images are only stored in those locations yet one will load and the other will not.    
    This is incredibly perplexing to me, and I'd appreciate any assistance.

    I would first try, in your IMG folder, renaming badfile.png to xbadfile.png and then duplicating goodfile.png to badfile.png, without changing any of your code.  Then run it and verify that you do see the png.  I.e. make sure that the problem really is with the png and not with your code somehow.

  • AS3 Load external image and add multiple instances to mcs

    Hi,
    Is there any way to load an external image and add it to more than one movie clip?
    Thanks,
    Chris McLaughlin

    Hi kglad,
    I was loading a larger jpeg to which I was applying 20 different masks so using the bitmapdata class to create duplicates was the best solution.
    It took me some time to wrap my head around it, but all is well.
    Thanks for pointing me in the right direction.
    Best regards,
    Chris

  • Is it possible to apply a PNG image *and* a gradient to a single div background?

    I am looking to create a div that will have a css gradient as a background, but also a PNG image to go on top of that gradient. This div will also contain text.
    So the desired stacking order is :
    Top : Live Text
    Middle : PNG image
    Bottom : CSS Gradient
    Question : Can this be done with only 1 div?
    I know that if you specify a background image AND a background color on the same div, you will get both, and it works quite well. But it seems much more complex to do it with a gradient instead of a flat bg color.
    If it's do-able, what would the syntax be?
    Thanks!

    Hi
    You could also use multiple background images, though this will not work in IE8 or below, (use Nancys 'stacking order' as a fallback but specify these first).
    #multipleBackgroundImages {
      background-image: url(gradient.svg),
                        url(your_image.jpg);
      background-position: top left, bottom right;
      background-repeat: no-repeat;
    see also - http://www.css3.info/preview/multiple-backgrounds/
    I specify an svg as the first image as this will work across all modern browsers.
    For IE8 or below -
    You could use an IEFilter for the gradient and an image over that, providing your image is not too large, or use the IEFilter 'alphaImageLoadeer' to place the image in the top r/h corner of the div, with the gradient below.
    PZ

  • Slideshow movie has stopped loading all images and stalls

    I made a basic slideshow that loads and plays photos with comments from an xml file.  I've just uploaded some new photo's and edited the xml to include them but now flash stops while loading the series of photo's and just stalls.  Removing the files from the xml does not work either and now I have no movie.  Tried various was of uploading etc and nothing works, the movie runs fine in testing locally.  It's extremly anoying as it was designed to be very simple to update with new images via the xml.
    attached are all the relevant files

    Not sure but I think preloaded.  I have waited it stops halfway through. Take a look here www.nathanielmcmahon.com.
    here is the actionscript
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var _this = this;
    var blend:String = 'noBlend'; // disolve, fadeInFadeOut, noBlend
    var slideShowWidth:Number;
    var slideShowHeight:Number;
    var slides:Array = [];
    var speed:Number = 1;
    var slideContainer:MovieClip;
    var myShowXML = new XML();
    myShowXML.ignoreWhite = true;
    myShowXML.load("slideshow.xml");
    myShowXML.onLoad = function(success:Boolean) {
        if(success){
            _this.slideShowWidth = this.firstChild.attributes.width;
            _this.slideShowHeight = this.firstChild.attributes.height;
            _this.speed = this.firstChild.attributes.speed;
            _this.blend = this.firstChild.attributes.blendMode;
            for(var i:Number = 0; i < this.firstChild.childNodes.length; ++i ){
                var data:Array = [];
                data.url = this.firstChild.childNodes[i].attributes.url;
                data.title = this.firstChild.childNodes[i].attributes.title;
                slides.push(data);
            createContainer();
            loadImage(0);
        else{
            trace('ERROR (could not load slideshow.xml)');
    function createContainer() {
        _this.slideContainer = _this.createEmptyMovieClip("slideContainer", _this.getNextHighestDepth());
        _this.slideContainer._x =215;
        _this.slideContainer._y = 0;
    function loadImage(loadCounter) {
        var loader:MovieClipLoader = new MovieClipLoader();
        var listener = new Object();
        loader.addListener(listener);
        loadCounter = undefined == loadCounter
            ? 0
            : loadCounter;
        _root.myClips_array = [];
        listener.onLoadProgress = function(target) {
            _this.preloader.textfield.text = "Loading.. "+(loadCounter+1)+"/"+slides.length+" Completed";
        listener.onLoadComplete = function(target:MovieClip) {
            target._alpha = 0;
            _this.slides[loadCounter].mc = target;
            if(++loadCounter < _this.slides.length){
                loadImage(loadCounter);
            else{
                _this.preloader._visible = false;
                moveSlide(0);
        //trace('load: ' +_this.slides[loadCounter].url);
        var mc = _this.slideContainer.createEmptyMovieClip(loadCounter, _this.slideContainer.getNextHighestDepth());
        loader.loadClip(slides[loadCounter].url, mc);
    function moveSlide(slideCounter) {
        trace('slideCounter: ' +slideCounter+ ' blendMode: ' +blend);
        //debug.text += slideCounter+ ' - ' + slides[slideCounter].url +'\n';
        slideCounter = slideCounter < slides.length
            ? slideCounter
            : 0;
        var slide:MovieClip = slides[slideCounter].mc;
        var title:String = slides[slideCounter].title;
        var textfield = getTitleText();
        textfield.htmlText = slides[slideCounter].title;
        textfield._y = Stage.height -textfield._height - 5;
        //trace(textfield._height);
        if('noBlend' == blend){
            slide._alpha = 100;
        else if('fadeInFadeOut' == blend){
            new Tween(slide, "_alpha", Strong.easeOut, 0, 100, 1, true);
        else if('disolve' == blend){
            new Tween(slide, "_alpha", Strong.easeOut, 0, 100, 3, true);
        doLater(this.speed, function(){
            if('noBlend' == _this.blend){
                slide._alpha = 0;
            else if('fadeInFadeOut' ==  _this.blend){
                var fadeOut:Tween = new Tween(slide, "_alpha", Strong.easeOut, 100, 0, 1, true);
                doLater(0.5, function(){
                    _this.moveSlide(++slideCounter);
                fadeOut.onMotionFinished = function(){
                    //_this.moveSlide(++slideCounter);
                return;
            else if('disolve' ==  _this.blend){
                new Tween(slide, "_alpha", Strong.easeOut, 100, 0, 5, true);
            moveSlide(++slideCounter);
    function doLater(time:Number, delegate:Function):Number {
        var intervalId:Number;
        var _delegate:Function = function() {
            clearInterval(intervalId);
            delegate();
        intervalId = setInterval(
            _delegate,
            time * 1000
        return intervalId;
    function getTitleText():TextField {
        if(this['titleTextfield']){
            return this['titleTextfield'];
        var titleTextfield:TextField = createTextField ("titleTextfield",_root.getNextHighestDepth (),15,0,180,100);
        titleTextfield.autoSize = "left";
        titleTextfield.wordWrap = true;
        //titleTextfieldt.htmlText = "<a href='http://www.myspace.com/thomasjack'target='_blank'><font color=\"#a17d4f\">MySpace page</font></a>";
        titleTextfield.html = true;
        var tf:TextFormat = new TextFormat();
        tf.font = 'Arial';
        tf.align = 'left';
        tf.size = 10;
        tf.color = 0x999999;
        titleTextfield.setNewTextFormat(tf);
        return titleTextfield;

  • Overlay two images and one of them is a bit transparent, but sill visible

    Hello,
    Is there a way to overlay two images of the same size and at the same time both of them to be visible ? I could't find anything about this in the forum so far.
    Thanks,
    IG 

    Hi igurov,
    see this link please.
    Mike

  • How to reflresh an image and draw another one?

    Looks like the typical paintComponent(g) and repaint() can paint
    something over the pixels which are not yet painted. If I want to
    replace the first image by the second one, how should I code?

    What jwmorsink said.
    repaint() calls update()
    update() does two things by default. 1. clear the background and 2. call paint()
    Note that you may get flickering. A standard way around this is to override update(). I'll leave it to you to figure out how.
    Of course, you can use off-screen images.

  • Draw 20% of one image and 80% of another?

    Hi all,
    I'm creating a UI functionality whereby a user holds down a button and an image of a glass slowly fills up.
    The way I'm thinking of implementing this is to have two different images, one of the empty glass and one of the full glass. As the user holds down the button, the image of the first is slowly replaced by the image of the second. E.g., after one second, 20% of the full image is shown at the bottom, 80% of the first is shown at the top.
    The timing stuff I think I can do with a thread, so I'm not too worried about that. However, what I need is a simple method, or maybe a whole class, that can take two images and draw x% of one on the bottom and y% of the other on the top.
    Can anyone think of a simple way to implement this?
    Thanks,
    Tim

    Hmmm... after playing with that a while, it doesn't look like that will do the trick. As far as I can tell, the drawImage methods will always scale the image if you pass it in a rectangle of a different size. So trying to get 50% of a full glass on top of an empty glass results in a squished full glass.
    Instead I realized I could do it using Graphs.clipRect, like so:
    public class OverlayedImageIcon extends ImageIcon
         private Image overlayImage;
         private float overlayPercent;
         public OverlayedImageIcon(URL url)
             super(url);
         public void setOverlayImage(Image image){
              this.overlayImage = image;
              loadImage(overlayImage);
         public void setOverlayPercent(float percent){
              this.overlayPercent = percent;
         public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
              super.paintIcon(c, g, x, y);
              Shape oldClip = g.getClip();
              int subtractHeight = (int) ((float)getIconHeight() * overlayPercent);
              g.clipRect(0, getIconHeight() - subtractHeight, getIconWidth(), getIconHeight());
            g.drawImage(overlayImage, x, y, getIconWidth(), getIconHeight(), getImageObserver());
            g.setClip(oldClip);
    }Thanks for pointing me in the right direction, though!

Maybe you are looking for

  • How can i read data in DCS data base

    I have logged current and voltage in dcs data base. I want to read that voltage with respect to time and plot in voltage Vs current graph. but i have a ploblem to read that data in dcs libary. can any one help me please. Thanks & Regard Nitin Jain

  • How can I play .caf files on Windows desktop computer

    I have a voice/sound recording program called Recorder Pro on my iPhone5.   It generates .caf files, which can be transferred to my desktop computer while the phone is connected, using iTunes/Apps (where the bottom left panel upon scrolling down has

  • How do I install itunes with Windows 7?

    how do I install itunes with Windows 7?  I always get a Windows Installer error or administrator error __

  • Macbook will not boot. Locked hard drive. Blue screen when booting

    Hi, my little brother decided he wanted a few files off of my mac book, so he went to settings>sharing>file sharing and added my only hard drive to the list and tried removing everyone but his name and password thinking it would only effect people tr

  • How do I set my side column width & height - Help ?

    Please see my website I am building using a Dreamweaver template  - it has a spry accordian menu in the right column - I am not skilled enough to understand how to set the height and width of this column   Can someone help?