How can I save a region of an image into another image?

How can I save a region of an image into another image? Should I use JAI?
Java2d? Is there an example?
Thank you.

Here is what I try, but I find out I just get a black square for my output image, can you please tell me what am I missing?
          ImageIcon file=new ImageIcon("images/clouds.jpg"); // You can't open bmp files
               // width, height looks correct:
               System.out.println (" width" + file.getIconWidth());
               System.out.println (" height" + file.getIconHeight());
               BufferedImage bi = new BufferedImage(file.getIconWidth(), file.getIconHeight(),
               BufferedImage.TYPE_INT_RGB);
               int x = 0;
               int y = 0;
               BufferedImage subimage = bi.getSubimage(x, y, 40, 40);
               File outputFile = new File("newimage.png");
               ImageIO.write(subimage, "png", outputFile);

Similar Messages

  • How can I drag and drop a Tidal job into another group?

    How can I drag and drop a Tidal job into another group? In Tidal Help, it says-
    In the Jobs pane, press and hold the Ctrl key and at the same time right-click and either individually select individual jobs within a job group or drag your mouse cursor over a block of jobs that you wish to select. You can only move multiple jobs between job groups if the jobs being moved are on the same level.
    Keeping the right mouse button depressed, drag the cursor to the job group that you wish to move the jobs to and release the mouse button.
    When moving jobs from one job group to another, you must decide if the moved jobs keep their original job group attributes or assume the calendar and agent characteristics of its new job group.
    A confirmation dialog, offers three inheritance options for the jobs moved to the "new" job group parent. Select one of the following options:
    However, when I attempt to follow those instructions, it doesn't work at all and there is no indication that it's even trying (i.e., I don't see the selected job following my cursor at all and all I get is the normal menu when you right click anywhere on the screen.)
    Is there another way to do this or is there a master setting that needs to be changed so that ability is enabled?
    Thanks.

    Go into edit mode for the job group group and just manually edit the section for Parent job/Group.
    Cheers

  • How can I save adobe reader file from gmail into my adobe reader app?? i would like to open one file in place where I'm not able to access internet and for that reason i would like to save it. is that even possible?

    How can i save adobe reader file from my gmail into my adobe reader application. or is there any other way i can save it into my phone so I'm able to open in any situation not just from my gmail???

    Long hold on the document in mail and it should give you the open in... option, select adobe reader and the file is now saved locally for viewing even while offline.

  • How can you save keynote slides as high resolution (300 dpi) images?

    Apparently there is a way to save powerpoint slides as 300 dpi images, with some finagling, but not the mac version.  Does anyone know how to do this in keynote?  Or is there a relativley easy way to do it with free/cheap software?  I can increase the dpi in photoshop, but it doesn't produce crisp images for obvious reasons.

    how can you save keynote slides as high resolution (300 dpi)
    to save individual images from each slide in Keynote;     file > export > images > TIFF (for optimum quality)
    You are using the wrong terminology to describe creating an image file
    - dpi ( meaning dots per inch )  is the measurement used in printing to create the number of print dots per inch that will be deposited on to physical media like paper or film   This is done in the printer settings box of the print driver and is dependant on how the individual printer can print..
    ppi ( meaning pixels per inch ) is the measurement you need to use when creating the number of pixels in a digital image file. You establish image resolution in Keynote using the inspector;     
    Keynote > inspector > document > slide size
    I can increase the dpi in photoshop, but it doesn't produce crisp images for obvious reasons.
    You can resample images in editing applications such as Photoshop or Painter but what you are doing is adding non image information to the image to increase pixel count, this is called noise. As you state this is not the procedure to use in your situation.

  • How can I save my music from ipod and use another itunes library?

    How can I save my music from my ipod (that I got from limewire), and use another itunes library?

    See this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • How can I attach or insert a received email into another email?

    Outlook allows you to attach an existing email from your inbox to a new email. How can this be done in Thunderbird? Copying and pasting the content does not include the date and time the email was sent.

    Virtually any file can be attached to a message open in the Write window by drag-and-drop onto the addressing area. This includes other email messages.
    An alternative approach is to forward the original message, in which case its body content can be inserted into a new message, or the whole thing can be sent as an attachment. Inline vs attachment is a user set option, but there are add-ons that let you decide at the point of starting your new message.

  • How can I save my Toolbar-Configuation an import to another workstation?

    Hello together!
    Can anybody help my with saving toolbar-configurations?
    I want to Export them to another Workstation.
    Thx a lot.
    Greetz D.Lehner

    There is Windows 7 64 Bit Enterprise installed.
    Especially InDesign, Photoshop, Illustrator and Bridge.
    Thx D.Lehner

  • Can I save selected pages from a PDF into another PDF

    In other words:
    I have a Pdf with 100 pages and I only want to save 10 pages.
    they are continuous i.e. pages 15-28
    I have Adobe XI version 11.0.07
    Thanks

    Hi greg14,
    For starters, you will need Acrobat to extract pages from a PDF. (It's not something that you can do with the ExportPDF service.) If you don't have Acrobat, you can download a free 30-day trial from www.adobe.com/products/acrobat.html.
    Then, to extract pages, you would follow these steps:
    Click on the Tools panel on the right side of the Acrobat window.
    Click Pages to expand that category.
    Click Extract.
    Enter the page range that you want to extract in the From: and To: text boxes.
    Click OK. Your pages are extracted into a new file.
    Choose File > Save As to save the new file.
    I hope that does the trick! 
    Please let us know if you have additional questions.
    Best,
    Sara

  • How can I copy a page from one document into another?

    I have produced a document in two separate fils and want to merge them into one.  There are six pages in each file, I need to put them I to one file, turn into a PDF and then mail them.

    Menu > View > Page Thumbnails > click on them > Copy > Paste into Thumbnails of other document
    Peter

  • How to preserve size when dragging image into another image?

    When dragging a 5x4in photo into a blank 11x8.5in image, the 5x4 is shrunk more than 50 percent.  Any fix for this?

    In a message dated 9/9/2014 12:28:44 AM Pacific Daylight Time,
    [email protected] writes:
    What are the involved images’ resolutions?
       293.63 pixels/cm into 823.193 pixels/cm
    Have you tried placing the image as a Smart Object?
    No, but just treid with same shrinking.
    Larry in Berkeley, California
    >

  • How can I save the 12-bits gray scale image ?

    Software & Hardware
    NI-IMAQ Vision 6.0
    NI-IMAQ for 1394 2.0.0
    Hamamatsu C4742-95
    I acqured the 12-bits gray scale image (Format7 , 640X512 size , 12bits) successfully.
    And CWIMAQViewer display the correct image of which the range is from 0(black) to 4096(white).
    But, I don't find the way to save this image with 12-bits format T.T
    Always, CWIMAQVision object save this image to 8-bit format.
    I tested all formats - tiff, bmp, aip, png.
    I think there are two possible problems.
    1. I dont't know the way to save the 12bits gray scale image. :{
    2. I dont't know the way to read the 12bits gray scale image that saved correctly.
    How can I save and load the 12-bits gray scale image ?
    What is the solution for this problem T.T ?

    Hello,
    I would recommend taking a look at the "ReadImage" Visual Basic project for more information on setting the image type and saving the image to file.  When you run the program, make sure you select 16 bit for your image.  You can also add another button to this example for saving the image.  Within the click subroutine for the button, you can add the line:
    CWIMAQVision1.WritePNGFile CWIMAQViewer1.Image, "C://image.png"
    This method will save the image in the viewer as a png file.  As long as it was loaded as a 16 bit image, it should save all of the 12 bit information into the file.  You could then test the new image by loading it using the example (you can see the pixel values by right-clicking on the viewer and selecting Settings>>Show Image Info.  The pixel value displayed in the info bar corresponds to the mouse position.
    Best Regards,
    Jesse D.
    Applications Engineering
    National Instruments

  • How can I save to the same map every time when printing pdfs?

    How can I save to the same map every time when printing pdfs?
    Finder points to the document map even when I chose a different map recently.
    I often print series of pdfs from the print dialog box, I'd like to choose the map to save to and then have all subsequent pdf prints automatically directed to the same map until I decide otherwise.

    that link seems to be broken right now:
    403 Error - Forbidden  - No cred, dude.

  • How can I save multiple titles under the same DVD?

    I use HandBrake to rip DVD's into iTunes. How can I save multiple titles under the same DVD? For instance, I have a Jimi Hendrix documentary that comes with special features, such as concert performances. I would like to have the main feature and the special features saved in my iTunes under the same title, perhaps as different 'tracks' (kind of like how different songs can be saved under the same album).
    Is there a way for me to do this, or am I chasing phantoms?

    *This response is for iPhoto 11 (v9). If you're using an earlier version, please post back and let us know. Troubleshooting steps are not the same for different versions. To find out which iPhoto you have: iPhoto Menu -> About iPhoto)*
    Duplicate the photo first. (Photos -> Duplicate). This means that you will have multiple copies of the master as well as the edited version.
    If you use versions like this often and wish to have only one master then you can do this with Aperture.
    Regards
    TD

  • How can i save my individual playlist on itunes on my external hard drive because i want to buy a laptop and install itunes and move all my music and playlist thats on my desktop to my laptop and almost all my music is from a bunch of cd's i own

    how can i save my individual playlist on itunes on my external hard drive because i want to buy a laptop and install itunes and move all my music and playlist thats on my desktop to my laptop and almost all of my music is from a bunch of cds i own

    Hello ryane84
    The easiest and most efficient way to copy your music is to follow the steps under the External drive section. Make sure that you have organized the iTunes library first before you copy it over. Then put the copied iTunes folder in the same Music folder on your computer.
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/ht4527
    Regards,
    -Norm G.

  • How can I save some pics from my Mac onto my Ipod touch?

    How can I save some pics from my Mac to my Ipod Touch ?

    Syncing photos with iTunes is explained here: http://support.apple.com/kb/HT4236
    You'll have to choose the photos you want to sync in the photo pane in iTunes with your phone connected, then apply sync.

Maybe you are looking for

  • JS error while using input fields with type=file on XP SP2

    Hi all, we found a new problem in applications which use input fields with type=file running in a browser on Microsoft Windows XP with SP2. A typical test layout might look like: <html>   <head>     <title>File-Upload</title>   </head>   <body>     <

  • 1.3 not respecting the aspect ratio set: new bug?

    I import a lot of scanned images, crop and straighten them and set a new aspect. I work with: Pentium 4, Windows, 1200x1600 monitor (portrait). I noticed with 1.3 what never happened to me with 1.2, as follows: a. select an image in Develop b. select

  • Buzzing with extrnal speakers

    Hi everyone, I have the following problem with my brand-new macbook (with leopard on it). I connected 2 pairs of external speakers to the headphone jack via a Y-adapter. Everything seemed to work fine when I suddenly started to hear a buzz from all o

  • Why Can't iCal Handle an Event in Two Time Zones?

    If I'm entering, say, a plane trip I'm taking that takes off in one time zone and lands in another, I can't enter this properly in iCal. Interestingly, if I'm entering this event in my iPhone's version of iCal, it works. That version of iCal has the

  • How to select a particular row in a JTable?

    I want to select a particular row in a JTable. i.e something like table.setSelectedRow(arg)how can i do it.