Results 1 to 4 of 4
  1. #1
    sayan751 is offline Member
    Join Date
    Feb 2009
    Posts
    29
    Rep Power
    0

    Question How to Scale an Image with the help of Affine Transformation?

    hi,
    i need to scale up/down an image(java image object).the image is created as :

    img=ImageIO.read(f)

    where 'img' is the java image object and 'f' is a image file from the hard disk.

    is it possible to do it with the help of affine transformation?

    i studied some examples but they are related with drawing an image in the frame with the help of simple functions such as fillrect() etc.but i need to deal with the real image file.

    plz help

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    Have you read through the methods of Image to see whether there's anything there related to scaling the image?

    db

  3. #3
    sayan751 is offline Member
    Join Date
    Feb 2009
    Posts
    29
    Rep Power
    0

    Default

    i checked the following link for scaling directly related with Image Class:

    java.sun.com/j2se/1.4.2/docs/api/java/awt/Image.html#getScaledInstance(int,%20int,%20int)

    but the method is not very much clear.
    getScaledInstance

    public Image getScaledInstance(int width,
    int height,
    int hints)

    Creates a scaled version of this image. A new Image object is returned which will render the image at the specified width and height by default. The new Image object may be loaded asynchronously even if the original source image has already been loaded completely. If either the width or height is a negative number then a value is substituted to maintain the aspect ratio of the original image dimensions.

    Parameters:
    width - the width to which to scale the image.
    height - the height to which to scale the image.
    hints - flags to indicate the type of algorithm to use for image resampling.
    Returns:
    a scaled version of the image.
    i have no idea what the hints is.need suggestions.is it possible to apply any other methods?

    Thanks for Your Reply

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    Read on in the API:
    See Also:
    SCALE_DEFAULT, SCALE_FAST, SCALE_SMOOTH, SCALE_REPLICATE, SCALE_AREA_AVERAGING

    Now see those also

    db

Similar Threads

  1. Transformation
    By rosh72851 in forum New To Java
    Replies: 1
    Last Post: 11-19-2008, 05:11 PM
  2. OpenGl transformation question newbie
    By ankitmcgill in forum New To Java
    Replies: 1
    Last Post: 11-16-2008, 04:46 AM
  3. How to use Scale in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:49 PM
  4. Transform Scale
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-21-2008, 09:53 PM
  5. Scale 2 or more pictures using a JSlider
    By Panchitopro in forum AWT / Swing
    Replies: 4
    Last Post: 05-20-2008, 05:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •