Adding Text to a pre-defined Image

I have an Image that is within a JInternalFrame and I am wanting to add text on top of the Image. I have tried using the getGraphics().drawString() method, however this requires that the image in question have been created with the create(w,h) constructor, where as my image is created using an MemoryImageSource.
Does anyone have any ideas as to how I could add text to a predefined Image? Perhaps using some sort of transparent Pane/Panel may work?
Cheers
J

Here's the code I used to solve my problem, for those that may be interested.
BufferedImage bf = new BufferedImage(imageWidth,imageHeight,
BufferedImage.TYPE_3BYTE_BGR);
G = bf.createGraphics();
G.drawImage(getImage(),0,0,null);     //Get the original Image
G.setColor(Color.red);
//Draw a rectangle surrounding the object
G.drawRect((od.getBBLeft()-1),(od.getBBTop()-1),
(od.getObjectWidth()+2),(od.getObjectHeight()+2));
//Add the object text to the image
G.drawString(text,(od.getBBLeft()-1),(od.getBBBottom()+20));
getPixels(bf);      
image.flush();     //Clear the presently displayed images chache
setImage(bf);     //Define the new image for the JInternalFrame
repaint();     //Call the repaint methods for this JInternalFrame
Cheers
J

Similar Messages

  • I don't want a pre-defined image size?

    Is there a program for pictures that doesn't require me to pre-define the image size? I want a program that doesn't make me choose the size of the image before I start. I might want to make it longer or taller, or shorter. I've been looking for a drawing type of program that will let me drag-drop smaller or bigger. Sorry to make the comparison, but something like MS Paint from '95, but without the crashy-ness of windows.

    Have a look here...
    When you create a new store account or sign in with an existing Apple ID (that you haven't used in the store), you must provide a payment method. If you want to remove the payment method after you create the account, you can change your payment information to None.
    From Here >  http://support.apple.com/kb/TS5366?viewlocale=en_US&locale=en_US

  • Adding Text to a Slideshow of images....

    Hi,
    I am still on iDVD 4.0.1 so could somebody please answer a couple of, hopefully, easy questions to help make my mind up about whether I should opt to buy the new iLife package (currently on version 06).
    I have created a slideshow and want to add text to each of the photographs, it is a family album so I want to add different text to each individual photo i.e. Auntie Marge 1964 etc....There doesn't seem to be a way of doing this in this version?
    I have burnt my first project to DVD but when I view it on the TV I am getting a warping effect on a number of images in the slideshow, any ideas why?
    So in conclusion, is it worth my while upgrading to the new iLife06 and will it include either a fix or a new feature that will help in the above queries?
    Thanks,
    Will.

    Hello Will,
    The best way to do what you want to do is to use iPhoto to create a slideshow, expanding the image viewing time to 5 seconds + for each image with or without Ken Burns and export it to Quicktime. Then import the Quicktime movie into iMovie. Next step is to split the clip at the playhead of each individual image and add a title with the 'over black' deselected. The subtitle option works well for this. It takes a bit of time to do, but there really is no quick way to do what you want to do. There are various plugins for iMovie as well and some do allow you to put text over batches of images, although I would guess you want to put different text over each image. I have done it a few times and it does come up really well. You can't do it with an iDVD slideshow.

  • Adding Text to a Buffered Image

    Hey
    I am trying to add text to a bufferedimage image and have tried a couple of ways.
    I cannot seem to get it to work propely though. Everytime i try, the text appears but the image appears inside the lettering of the text and not under it like i want it to.
    Could someone please explain the best way of place text on TOP of an image as i am really stuck now :(
    Thanks in advanced for any help

    Basically paint your buffered image into a new BufferedImage and then paint in the new text on top.
    Here's a demo.
    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    public class BufferedImageTest
        public static void main(String[] args)
            ImageGenerator ig = new ImageGenerator();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(ig.getOriginalImagePanel(), "North");
            f.getContentPane().add(ig.getTextPanel(), "South");
            f.setSize(400,640);
            f.setLocation(200,50);
            f.setVisible(true);
            f.getContentPane().add(ig.getNewImagePanel());
            f.validate();
            f.repaint();
    class ImageGenerator
        JPanel originalPanel = new JPanel()
            public void paintComponent(Graphics g)
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D)g;
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                    RenderingHints.VALUE_ANTIALIAS_ON);
                int w = getWidth();
                int h = getHeight();
                g2.setPaint(Color.blue);
                g2.fill(new Rectangle2D.Double(w/16, h/16, w*7/8, h*7/8));
                g2.setPaint(Color.yellow);
                g2.fill(new Rectangle2D.Double(w/8, h/8, w*3/4, h*3/4));
                g2.setPaint(Color.red);
                g2.fill(new Ellipse2D.Double(w/6, h/6, w*2/3, h*2/3));
                g2.setPaint(Color.green);
                g2.draw(new Line2D.Double(w/16, h/16, w*15/16, h*15/16));
        JPanel textPanel = new JPanel()
            Font font = new Font("lucida sans regular", Font.PLAIN, 32);
            String text = "A New Label";
            public void paintComponent(Graphics g)
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D)g;
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                    RenderingHints.VALUE_ANTIALIAS_ON);
                g2.setFont(font);
                FontRenderContext frc = g2.getFontRenderContext();
                LineMetrics lm = font.getLineMetrics(text, frc);
                float textWidth = (float)font.getStringBounds(text, frc).getWidth();
                int w = getWidth();
                int h = getHeight();
                float x = (w - textWidth)/2;
                float y = (h + lm.getHeight())/2 - lm.getDescent();
                g2.drawString(text, x, y);
        public ImageGenerator()
            originalPanel.setBackground(Color.white);
            originalPanel.setPreferredSize(new Dimension(300,200));
            textPanel.setOpaque(false);
            textPanel.setPreferredSize(new Dimension(300,200));
        private BufferedImage createNewImage()
            BufferedImage image = new BufferedImage(originalPanel.getWidth(),
                                                    originalPanel.getHeight(),
                                                    BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = image.createGraphics();
            originalPanel.paint(g2);
            textPanel.paint(g2);
            g2.dispose();
            return image;
        public JPanel getOriginalImagePanel()
            return originalPanel;
        public JPanel getTextPanel()
            return textPanel;
        public JPanel getNewImagePanel()
            JPanel panel = new JPanel()
                BufferedImage image = createNewImage();
                public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    Graphics2D g2 = (Graphics2D)g;
                    g2.drawImage(image, null, 0, 0);
            return panel;
    }

  • Trying to change a pre-defined report. Date format is wrong, 20140217 should be 17.02.2014.

    The pre-defined report in sccm "Computers with specific software registered in Add Remove Programs" has a query like this:
    Select DISTINCT sys.Netbios_Name0, fcm.SiteCode,  sys.User_Domain0, sys.User_Name0, sys.Operating_System_Name_and0, arp.DisplayName0,
    arp.InstallDate0  
    FROM fn_rbac_R_System(@UserSIDs)  sys 
    JOIN v_Add_Remove_Programs arp ON sys.ResourceID = arp.ResourceID  
    JOIN v_FullCollectionMembership fcm on sys.ResourceID=fcm.ResourceID 
    WHERE DisplayName0 like @filterwildcard and fcm.CollectionID=@CollID
    I have highlighted the part that I added to the report.
    I have inserted an extra column in Report Builder, and added the value inside the column and the install date can be viewed in the report. However the date format is shown like this: 20140217 - I want it to be 17.02.2014.
    So I try to change this via right-clicking on the cell in Report Builder, Text Box Properties, Number. Here I choose Date and the correct format. However it does not change the date format when saving and running the report again. It just stays the same. 
    Kthxbai

    The format can be change if it was a date. But if you look that field it is NOT a date, it is a string and therefore will not  change to the data format that you want.
    On top of this, there is a bigger problem. Not ever setup records the date or in the same format so.....
    http://www.enhansoft.com/
    Sorry - I am not sure what you mean by the last statement. "Not ever setup records the date or in the same format so.."
    - Would it be possible to elaborate? Thank you very much.
    Kthxbai

  • Create "pre-defined" comments?

    Hello!
    I'm using Acrobat for proofreading and would like the proofreaders to always include certain information (like "describe what has to be changed", "why is the change needed", etc.).
    I wonder if it is possible to include this directly when they are adding a new comment, so they can clearly see how to meet the need for "comment informaiton"?
    Can such notes be created, or is it possible to adjust in Acrobat so the comments in the PDF-files for proofreading always contain certain ("pre-defined") information?
    //Henrik

    It's not possible with a script. Maybe with a plugin, but those are quite complex to develop... You can try asking over at the Acrobat SDK forum.
    What you can do with a script, though, is have it edit all the comments on a page (or in the entire document, or the selected ones, etc.), and add this text to them.

  • Adding Text to a photo...Need help

    I'm new to Adobe Photoshop Elements 7. I'm following the instructions for adding text to a photo, but I can't see what I'm typing. I can see the cursur, but nothing else. I can see the text in the Layer, but not on the photo. Please help.

    Check the font size in the options bar. If it's really small you won't see it.
    Look in your layer's palette and insure your text is in a layer located above the photo in the stack.
    You might also check your image's resolution in the Image Size dialog. I've seen a couple of posts where someone changes the resolution to 1 with resample turned off...then can't see the text because it's too small even when they have large numbers inserted in the font size box.

  • VJO in not defined & image corrupt or truncated,only in FF & also safe mode but ok in private browsing

    VJO not defined & image corrupt or truncated
    I am getting this error when the computer renders some websites. It happens with ebay & on youtube. It shows the text but no pictures or background. I am running Windows 7 Home Premium 64bit and Firefox 4.0.1 it also happens in the newest version of FF & in safe mode , I have installed the latest Java runtime with no change ,but interstingly if I turn on "in private browsing" FF runs OK.
    I have run Firefox in safe mode, I have uninstalled completely using the APPS own uninstaller & then cleaned up all the files left behind with a 3rd party uninstaller I have updated Firefox to the newest release & rolled back to v4.0.1,I have disabled all addons & AV & malware apps (just for a minute)I have even tried a system restore. Also the "VJO not defined" only happens with FireFox & not with IE.interestingly FireFox runs fine if I enable "in private browsing"

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    * Tools > Options > Privacy > Cookies: "Show Cookies"

  • Adding text to a photo in iphoto

    How do you add text to a smart album photo?  Also, when syncing to my iphone, I want the text to appear.  I am building a tropical plant field guide.

    iPhoto has no capability of adding text onto an image.  For that you'll need a 3rd party image editor setup as the  external editor in iPhoto.
    Some Image Editors that support  layers:
    Photoshop Elements 11 for Mac - $79
    Rainbow Painter - $30
    Imagerie - $38
    Acorn - $50
    Pixelmator - $60 
    Seashore - Free
    Portraits and Prints - Free
    GIMP for Mac - Free
    OT

  • Adding text to photo

    I would like to add text to photos - that is have the text appear on the photo itself. Can I do this with iphoto?
    Thanks, M.

    Not easily with iPhoto only, but Martin S. has directions for doing so here:
    http://simnet.is/klipklap/iphoto/adding-text/
    Rather easier is to use an external editor for the job: starting with free and working up:
    Seashore
    Graphic Coverter
    Acorn
    Photoshop Elements
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.
    Regards
    TD

  • Adding Text

    Can anyone help me out on adding text to an image. I have followed the instructions in both books and videos on how to add text (using the text tool) and when I get to the point of typing text in, it doesn't go 'in'. The box that I assume it should show up in just stares at me - blank. What am I missing?

    David,
    Also, there are basically two types of Text: Paragraph Text, where you first drag a Text Box, and what I'll call "Open Text," 'cause I'm having a brain cramp and cannot come up with the proper syntax. There are some differences in the behavior of the two. The manual (do they still ship those, or is F1 the only recourse nowadays?), should make the distinctions clear.
    Also, when Text does not behave, as you think it should, look at your Layers Palette. Since about version 5, PS creates a Text Layer, when you start using the Text Tool. Make sure that you are in the correct Layer. If it doesn't seem to be working still, Dbl-click the icon with the T in the correct Layer. You should see your Text selected/highlighted. With the Text Tool, you can edit, or add to from there. This gets you on the correct Layer. If you first just click with the Text Tool, you are most likely creating a new Text Layer, which is not what you want, if you intend to edit, or add to existing Text. Always keep the Layers Palette open and in view. When things don't work, check to see just which Layer is active. That is NOT just for Text, but for almost everything in PS.
    Good luck, and let us know how it goes. I also like the "Classroom in a Book" series from Adobe Press. They step you though many aspects of PS in little "projects." They are fun, expose you to things that you might not find for a bit, and are highly informative.
    Hunt

  • Error: pre-defined filters are no longer available in the universe

    Hi All,
    I'm getting following error message while schedule the webi report .
    "Some pre-defined filters are no longer available in the universe. See your Business Objects administrator. (Error: WIS 00003) ".
    I have migrated the universe and reports from XIR2 to XIR3.1 ; and getting above error in XI3.1 , its works fine XIr2.
    Based on this error i have checked the Predefine filter in universe and its available . but report  shows error.
    Also i have created the new conditions with different name and added into report. but again i getting same error while schedule the report
    However reports run fine after changed the sql mode as custom sql with same sql from objects and conditions.
    Could you please anyone help for this issue?
    Advance Thanks
    Ponnarasu

    Hi SC,
    Thanks for your reply . our version 12.3.6.1006. X1 3.1 was installed with SP3 .
    Anyway this issue is resolved via following method.
    I have created the new universe  ( Create new universe and copied schema and objects from exiting universe )  and exported in to universe folder . All related reports query changed to new universe. Now reports runing fine and without error.
    Thanks
    Ponnarasu

  • How to set pre-defined constants via FXML

    Does anymode know how to set a pre-defined constant like javafx.scene.control.Control.USE_PREF_SIZE via FXML when you create a node?
    Instead of using a fixed value like this
       <Label text="Last Name:" minWidth="100" />I would like to use one of the predefined sentinel values like this.
       <Label text="Last Name:" minWidth="USE_PREF_SIZE" />The above example does not seem to work and I have the feeling that this is currently not possible at all.

    How did you get that working? When I use the following file I only get a warning that "javafx" is not defined.
    Defining var A seems to work but it fails on var B. It seems to be impossible to access anything outside the
    java... hierarchy. Is there anything else you have to define?
    <?xml version="1.0" encoding="UTF-8" ?>
    <?language javascript?>
    <?import javafx.scene.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.control.*?>
    <StackPane xmlns:fx="http://javafx.com/fxml" >
         <fx:script>
              var A = java.awt.Component.BOTTOM_ALIGNMENT;
              var B = javafx.scene.control.Control.USE_PREF_SIZE;
         </fx:script>
    </StackPane >   

  • Are there pre-defined photo layouts in Aperture as there are in iphoto

    I have looked at Aperture Boo layouts but pre-defined page layouts as per iphoto seem to be missing do I have to start
    from scratch and design my own?
    Am thinking I should stick with iphoto.....

    Different programs different layouts.
    I know that the slideshow themes from iPhoto 11 are useable in Aperture, not sure about the book themes.
    As for sticking with iPhoto or moving to Aperture, if your major use of iPhoto is making books, calendars or the other consumer type projects that iPhoto does well, then you might be better off sticking with  iPhoto. Aperture is definitely lacking when it comes to these.
    However from both an image management perspective and image adjustment perspective Aperture wins hands down.  One way around this you might want to consider is to use Aperture as your main photo program and only use iPhoto for these tasks.  In iPhoto under File is the ability to access the Aperture library. ranted you only have access to the Aperture previews this way but you can set the preview quality in Aperture to what ever level you need to get he print quality you want.
    regards

  • I'm adding text to a photo.. Trying to get an S to lay down

    I'm adding text to a photo and can't get an S to lay down?

    I'm guessing on what you are trying to do, to some extent, but see if this helps.  Your photograph will have a horizon, and perspective.  For instance, if there are any buildings in the image, lines drawn through the top and bottom edges of the building, and extended to the horizon, will always intersect at the same point.  If you lay down some guides as shown in this illustration, and overlay some perspective lines with a 1 pixel line, then use the resulting box to Free transform the letter S to.
    It is _much_ easier if you Rasterize the text layer, because that will cause the Free Transform bounding box and handles, to fit tightly around the text.  Otherwise the bounding box will be larger than the text to include descenders and risers for the font used.
    So with guides and guide lines in place, and the text rasterized, use Free Transform, and hold down the Ctrl (Cmd) key will dragging the corner handles to the intersect points.
    In the illustration I have made a nice simple concentric perspective, but that probably won't be the case in your image.  But if you use clues from the image, you will be able to work out its true perspective.  In fact I rarely resort to using guides, and just do it by eye.
    A little tip when doing this is to make the object a Smart Object before using Free Transform.  The reason is if you decide to tweak the perspective and use FT a second time, with an SO layer the handles will still be in the corners.  A normal layer will now have the FT handles square to the document edges, which makes it much more difficult to refine the shape.
    BTW  Thanks for asking a proper, interesting, question about using Photoshop, as opposed to the usual 'My dog has eaten my serial number' posts.

Maybe you are looking for

  • Can an icloud locked ipod still be used with a bluetooth item an app?

    I have a bluetooth fixator node (variable inc) that has to be run on ios and need the low energy bluetooth 4 and works in conjunction with 2 apps. if I buy an icloud locked ipod touch woul I be able to do this? I have no intention of using the ipod t

  • Missing and Moved Page Numbers?

    I'm having a problem losing folios; I have a 300 page book where all of the page numbers are centered horizontally.My editor ran a final spell-check and 'saved as,' yet in this new document, on pages where I have over-rode the Master page, the pages

  • CS 5.1 -64 Photoshop [Camera RAW] *.CR2 raw import error

    Hi folks. When try to open a RAW file into Photoshop (Camera RAW), error message occur: "Could not complete your request because the file appears to be from a camera model witch is not supported by the installed version of Camera RAW". This photo was

  • Why is SPList.GetItems(SPQuery) returning always the same item to different SPQueries?

    Hi, I have this powershell code: $url = 'http://artemis/customers' #web URL $ctx = Get-SPServiceContext 'http://artemis' #site URL $scope = New-Object Microsoft.SharePoint.SPServiceContextScope $ctx $web = Get-SPWeb $url $listSyncZakazky = $web.Lists

  • Assignment Date Track History-Changed Field Summary

    Hi all, We have Oracle HR 11.5.7 FP.G. In the HRMS there is a for the Employee's Assignment Date Track History showing the Changed Field Summary. We want to specify the exact field(s) changed in Assignment for a period using SQL or Discoverer for Rep