How to resize image using java imageio

Hello ,
I want to know how to resize image using java imageio.
I dont want to use java awt because i am writing a web application.
help is very much needed
thank you.

Just use an AffineTransform !
Its much easier

Similar Messages

  • How do I overlay n number of  bitmap images using Java.

    Hi All,
    I have a task of creating a composite bitmap or a .gif image from "n" number of bitmap images , so that the resulting composite image will look like as if all those "n" images were placed side by side . How can I achieve this ? Can you point me to some place where I can understand the concepts behind this?

    Create a new BufferedImage with the dimensions of all the images you want combined, then paint all the images into it through the Graphics object you can obtain from the BufferedImage. Then write out the image using the ImageIO class.

  • Hello, i am new to the mac and i need to learn how to re image using an external hard drive

    Hello, i am new, like baby fresh new,...lol, to the mac and i need to learn how to re-image using an external hard drive.

    How to replace or upgrade a drive in a laptop
    Step One: Repair the Hard Drive and Permissions
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Installer menu (Utilities menu for Tiger, Leopard or Snow Leopard.) After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    Step Two: Remove the old drive and install the new drive.  Place the old drive in an external USB enclosure.  You can buy one at OWC who is also a good vendor for drives.
    Step Three: Boot from the external drive.  Restart the computer and after the chime press and hold down the OPTION key until the boot manager appears.  Select the icon for the external drive then click on the downward pointing arrow button.
    Step Four: New Hard Drive Preparation
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your new hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area.  If it does not say "Verified" then the drive is failing or has failed and will need replacing.  Otherwise, click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID  then click on the OK button. Click on the Partition button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    Step Five: Clone the old drive to the new drive
    1. Open Disk Utility from the Utilities folder.
    2. Select the destination volume from the left side list.
    3. Click on the Restore tab in the DU main window.
    4. Check the box labeled Erase destination.
    5. Select the destination volume from the left side list and drag it to the Destination entry field.
    6. Select the source volume from the left side list and drag it to the Source entry field.
    7. Double-check you got it right, then click on the Restore button.
    Destination means the new internal drive. Source means the old external drive.
    Step Six: Open the Startup Disk preferences and select the new internal volume.  Click on the Restart button.  You should boot from the new drive.  Eject the external drive and disconnect it from the computer.

  • How to send attachments using java application and outlook

    Hi ,
    I created an application in java which is as
    on the Conference Tab i can schedule a conference and with the send command on page it map all the scheduled data to outlook(with all conference details) and using outlook send option the mails are send to appropriate user.
    but now i want to modify this application such as when i use the send command from my jsp page it should attach the file that is in .vcs or .ics format for auto updation of user calender.
    can any one know how to send attachment using java application .

    Last time I checked, SMS was a service between carriers and doing SMS yourself was really tricky. Some services existed to let you do it but as I recall they wanted non-trivial money.
    However, most phone carriers provide an email-to-SMS bridge of some kind.
    So the easiest thing is just to send an email.
    That's sending from a non-phone to a phone. There's a J2ME library to send/receive SMS from/to a phone.
    However, this is from memory, and a little out of date, so I could be entirely wrong. Hope it helps anyway.

  • How to resize image on my mac?

    How to resize image on my mac?

    What version of Mac OS X do you have? In Preview under 10.9 Mavericks (I believe 10.8 too), this is what I see:
    The padlock is next to the unit (pixels, etc) selection box.
    Matt

  • How to get image using Http and how to save in Smulator

    Hi guys,
    Am working in black berry bold. i dont know how to get image using htp connection and one more thing i need to save this image in side simulator directory............. what are the specific API i should...
    Guide me.........

    If you want the input image size you need to pass it in as parameters.
    A discussion thread on this topic is:
    http://forums.adobe.com/thread/29948
    -- Daniel R. <[email protected]> http://danielr.neophi.com/

  • How to read OVD using java

    Hi all,
    how to access OVD using Java?
    Thanks,
    Kumar.P

    Hi,
    You can just normal LDAP API codes to connect to OVD the same way you connect to other LDAP servers.
    PFB sample code for connecting to OVD.
    Properties props = new Properties();
    try {
    props.load(new FileInputStream("LdapCredentials.Properties"));
    } catch (IOException e) {
    // TODO
    ldapurl = "ldap://hostname:390";
    ldapUser = "cn=orcladmin,ou=Org12,dc=ovid,dc=com";
    userPassword = "welcome1"; //"Killtheking123456";
    userContext = "ou=Join1,dc=ovid,dc=com";
    Now, you have to get Directory Context as shown below.
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, ldapurl);
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, username);
    env.put(Context.SECURITY_CREDENTIALS, password);
    //Initialize the Directory context
    DirContext dCtx = new InitialDirContext(env);
    Then you can perform search operations or new user creation etc., as you wish.
    Does this help?
    -Mahendra.

  • How to resize image in JSP using JAI ??!!

    Please help me how to resize an JPEG image from my JSP, could I use JAI lib ? how ?

    Hello,
    I had the same problem few months ago ( in that case i used Jimi instead of JAI).
    The answer to your question is: use the java class called "Image".
    Infact you can use JAI just for load or save to disk your image that you have to resize and then use the following code to resize the image :
    Image imgResized = img.getScaledInstance(100,1,Image.SCALE_AREA_AVERAGING);
    The object "img" is the image to resize and the object "imgResized" is the image resized with width equals to 100 and with a right height.
    I used Jimi just to save my image and i think that with JAI there is a method to do this.
    You can use JAI to load in memory your image too so you can avoid problem with MediaTraker class.
    I hope that this can help you.
    Cheers.
    Stefano

  • How to convert JPEG - PNG images using java?

    Hi,
    Has anyone done this before?
    Can you provide me with a sample code or point me to the direction on how this can be done?
    Are there any existing Java technology that supports this?
    Most grateful. Thanks.

    It's should be easy using Java Advanced Imaging (JAI). Try this.
    import javax.media.jai.JAI;
    import javax.media.jai.RenderedOp;
    public class convert {
      static public void main(String[] args) {
        String inName = args[0];
        String outName = args[1];
        RenderedOp source = JAI.create("fileload", inName);
        JAI.create("filestore", source, outName, "PNG", null);
        System.exit(0);
    }

  • How can i generate BARCODE Images using JAVA Code

    Hello ,
    My requirement is to generate BarCode Images to Print using JAVA Code.
    User will give only
    1) String.as Input Parameter and
    2) Type of Encoding you want to apply on to the String.
    outPut : code should generate Bar Code Images as per the requirements.
    can any one help me out with jars ????? or any link which can provide me start.

    1) I have requriement like generate doc file with
    more than one barcode image on that document.???
    So?
    If your chosen "doc file" format supports inclusion of multiple images there's no problem.
    If it doesn't, choose another format.
    2) I am able to generate .doc file but in which
    format i should open that doc file.????
    The same format you used to create it.
    3) Main thing is how can i put more than one barcode
    image on that doc file????
    That would depend on the file format and the API used to create it.
    is any one faced the same problem or gone through
    same requirement.
    Almost certainly. And they solved it too, given the document I'm looking at right now which is an e-ticket for an airline that has many barcodes and other generated images on it.
    So keep on trying, grasshopper, and you may find enlightenment.

  • How to extract the number from image using java

    Hello every one
    i want to develope a project which can extract the number from image
    that i can use as inter or String or char.
    Is there any API in java which provide this type of facility.
    right now i m using java 5
    thanks in Advance
    Jignesh

    In my project i have a image in that i have a
    co-ordinate (x,y) I am still puzzled as to what you seek. It sounds to me like you have a point (x, y) represented by p. in java it's just p.getX() p.getY()
    i want to convert that cordinate to numeric form,
    i mena i want to use that cordinate in somewhere else
    in project.point.getX() point.getY()
    So need to convert it into numeric form u can called
    it OCR also.OCR is optical character recognition. If I want out and took a picture of the US Declaration of Independence and then wanted the words on the parchement in the picture in text form, then I would run the picture through a software program and it would try to optically recognise what lettering and number were present in the picture. In the end, I would have a text of what is written on the US Declaration of Independence.
    Is that what you want?

  • How to move image in Java Awt.

    Hi ,
    I am developing a simple application using Java awt.
    I have created a application which displays a image. now i want it to move automatically using a timer or something.
    How can i do it. if i have to change the x and y position of the image in which function should i do it?
    Which is the function which is called for every frame?
    Thanks
    Glen.

    public void paint(Graphics g)?
    Are you making a game by any chance?

  • Hey need help reading images using java bean

    Hey everyone,
    I will like to read some images from a directory using Java and display it on a JSP page, how do I accomplish this,
    thanks
    KT

    What happen is, I have to display 52 card depending on string concatenation, I have a java file that takes two elements from an array, depending on the two strings concatenation I want to display an image on a jsp page, any ideas on how to accomplish this?

  • How to upload image using JSP

    hi,
    i am confronting a problem how to upload image from local PC to web server . I am using Tomcat 4.0
    please help me by sending code
    thanks

    Hi,
    Here is the solution for uploading images and displaying images. I am using struts with JSP, so this code has a Action and ActionForm class. You can put the same code in Java Beans or Servlet class to run it. This code has two JSP files - one for Upload (upload.jsp)and other for Image(image.jsp) display. It has a Servlet also to display the image. Here is the code file wise.
    Upload.jsp **********************************************************
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html>
    <head>
    <title>New Page 1</title>
    </head>
    <body>
    <html:form action="uploadAction.do" enctype="multipart/form-data" method="POST">
    <p>File to upload   
    <html:file property="fileUpload" size="20"/></p>
    <p><html:submit value="Upload" property="upload"/></p>
    <p> </p>
    <p><html:img src="image.jsp"/></p>
    <p> </p>
    </html:form>
    </body>
    </html:html>
    Image.jsp*****************************************************************
    <jsp:useBean id="upload" class="uploadtest.uploadActionForm" scope="session">
    </jsp:useBean>
    <%
         byte[] rgb=(byte[])session.getAttribute("byte");
         request.setAttribute("byArr", rgb);
    %>
    <!--
    The image data is now on the request object.
    Forward the user to the showImage servlet.
    That servlet will process and display the image data contained on the request object.
    -->
    Image is<p>
    <jsp:forward page="/showimage" />
    Struts Action Class - UploadAction.java **************************************************
    import javax.servlet.http.*;
    import java.io.*;
    import org.apache.struts.upload.FormFile;
    import org.apache.struts.action.*;
    public class uploadAction extends Action {
    public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    uploadActionForm upload = (uploadActionForm) actionForm;
    try {
    int size=upload.getFileUpload().getFileSize();
    //if (image != null) {
    byte[] byteArr = new byte[size];
    //Create an input stream to read the uploaded file.
    ByteArrayInputStream bytein = new ByteArrayInputStream(upload.getFileUpload().getFileData());
    // Load the input stream into the byte Array.
    bytein.read(byteArr);
    // Close the input stream.
    bytein.close();
    // Load the byte[] into the content field.
    upload.setContent(byteArr);
    HttpSession ses=httpServletRequest.getSession();
    ses.setAttribute("byte",byteArr);
    return actionMapping.findForward("success");
    } catch (Exception ex) {
    ex.printStackTrace();
    return actionMapping.findForward("success");
    Struts ActionForm class ---uploadActionForm.java***************************************************
    package uploadtest;
    import org.apache.struts.action.*;
    import org.apache.struts.upload.*;
    import javax.servlet.http.*;
    public class uploadActionForm extends ActionForm {
    private FormFile fileUpload;
    private byte[] content;
    public FormFile getFileUpload() {
    return fileUpload;
    public void setFileUpload(FormFile fileUpload) {
    this.fileUpload = fileUpload;
    public byte[] getContent()
    return content;
    public void setContent(byte[] theFile)
    this.content = theFile;
    public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    /**@todo: finish this method, this is just the skeleton.*/
    return null;
    public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    Servlet to display image --- ShowImage.java ********************************************************
    import java.io.*;
    import java.util.*;
    public class ShowImage extends HttpServlet {
    //Initialize global variables
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    byte[] rgb = (byte[]) request.getAttribute("byArr");
    if (rgb != null)
    response.setContentType("image/gif");
    OutputStream stream = response.getOutputStream();
    stream.write(rgb);
    else
    response.setContentType("text");
    response.getWriter().write("attribute byArr not found");
    This code will enable to to upload and display the image. If you know Struts, then you can write the Struts-Config.xml file by yourself. Other wise write to me, I will send you that. If you want to save the image in database, then you have to keep it as BLOB datatype is database. For database you need to send the byte array in the uploadAction.java file to database. Database will keep the image as binary.
    Thanks
    Amit

  • How to resize image with high quality

    I refer lot of examples in image resizing. But quality of resized image not good. pls can give me solution for that with code?

    I refer lot of examples in image resizing.Have you read [_this article_|http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html]?
    db

Maybe you are looking for

  • Can't open pdf docs

    I just downloaded and installed Adobe Reader XI (Mac), but I still can't open my pdf docs.

  • Problem stopping the Labview Starter Kit motors (huge offset?)

    Hi I implemented an algorythm for the Labview Starter Kit. It reads a map and navigates from the initial point to the goal. The Starter Kit only performs two movements: "go straight X mm", and "turn 90º left/right (the turning is made when stopped, l

  • Dynamically calling selection screen in loop

    Hi all     Please help me to solve this problem.I need to call a selection screen(like a dialog screen) containing 2 fields depending on the loop counter in a program. Thank You. Regards Giri.

  • Where do I find activation code for photoshop subscription?

    I just bought the subscription  offer for Photoshop CC + Lightroom, buty haven´t received activation code. How can I get my activation code?

  • Cannot add HP Deskjet 3820 printer

    We have been using an HP Deskjet 3820 printer with an iMac forever with no problems. The printer is connected from the printer parallel port to the USB port on the computer using an adapter cable. Last time we tried to print the print job stopped in