Which approach to use for resizing image

There are two ways of resizing images as I know:
1. image.getScaledInstance(width,height,hint);
Using hint like Image.SCALE_AREA_AVERAGING gives somehwat satisfactory resizing.
2. static BufferedImage resize(GraphicsConfiguration gc, BufferedImage source, int w, int h, Object hintValue) {
BufferedImage result = gc.createCompatibleImage(w, h, source.getTransparency());
Graphics2D g2 = result.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hintValue);
double sx = (double) w / source.getWidth(), sy = (double) h / source.getHeight();
g2.drawRenderedImage(source, AffineTransform.getScaleInstance(sx, sy));
g2.dispose();
return result;
where the hint passed is RenderingHints.VALUE_INTERPOLATION_BILINEAR ;
Now which of the two method method should I use-using image.getScaledInstance() or using AffineTranform ? opr is there any other way which is faster but provides good result?
i am creating an image editor, so the GUI dialog will have oprtion to choose the algorithm. I want the method which provides better result yet faster.
Tanveer

http://forum.java.sun.com/thread.jsp?forum=20&thread=522483

Similar Messages

  • HT1918 I am trying to enter the No. Of my VISA card (which I normaly use for payments) in the billing info of my account and it is not accepted. Does anyone have any idea why?

    I am trying to enter the No. Of my VISA card (which I normaly use for payments) in the billing info of my account and it is not accepted. Does anyone have any idea why?

    JarleEkanger wrote:
    How about this? Use Delete array subset to extract chunks for averaging, and a shift register to retain the remaining array.
    It is typically not advisable to use "delete from array" in a tight loop. The constant memory reallocations due to array resizing are probably inefficient.
    Here's one simple way to do it..
    (If the number of points is not divisible by 10, the excess tail is discarded. You can easily modify that behavior if desired.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    averages of 10.png ‏5 KB
    averages of 10.vi ‏9 KB

  • What method should be used for resizing the particular JTable Column width

    I have a four table. Only one table which are on top have a table header. I want that when user resize the topmost table with a mouse other table colume also be resized automatically. So I want to know that what method should be used for resizing the particular JTable Column width.
    Thanks
    Lalit

    maybe you can implement a interface ComponentListener as well as ComponentAdapter with your topmost Table.
    for example:
    toptable.addComponentListener(
    new ComponentAdapter(){
    public void componentResized(ComponentEvent e){
    table1.setSize(....);
    table2.setSize(....);
    /*Optionally, you must also call function revalidate
    anywhere;*/
    );

  • Which method is used for event creation

    Dear All,
    My client has more then one Purchase Organization. Workflow for Purchase order release very from pur org to pur org. For example - workflow WS92000030 is trigger when PO is created for India pur org where as workflow WS92000021 is trigger when PO is created for US pur org.  
    I checked and found that same Object Type - BUS2012 & event - RELEASESTEPCREATED is used in all Pur. Org PO release workflow. Also I found in Transaction code - SWETYP that Type linkage activate for  BUS2012, RELEASESTEPCREATED in all the PO workflow - WS92000030 & WS92000021.
    As per my knowledge, event can be created in various way such as Function module, Change document, General status management, Business Transaction Events etc.
    Can some one guide me, how can I found that which method is used for event creation in different pur org?
    How can I fould what is the fuctional module used for event creation if Fuctional module used for event creation. 
    For your information, I can see in T. Code - SWUO that 'Result dependent on a check function module'  for all the workflow - WS92000030, WS92000021 etc.
    Thanks in

    Hi Sahu,
    I dont think they have used the Function module or change document or any other kind of methods to trigger the workflow. This is because RELEASESTEPCREATED method is a standard method and it will be triggered by standard SAP. They can not make changes in standard sap saying RELEASESTEPCREATED should be triggered for this Purchase Org .
    Istead what i think is, they might have given the Event Condition for each workflow.
    In SWDD>> basic settings>> Start Events, we can give condition on triggering the workflow.
    Please check this.
    Regards,
    Gautham

  • Which CKM is used for moving data from Oracle to delimited file ?

    Hi All
    Please let me know Which CKM is used for moving data from Oracle to delimited file ?
    Also is there need of defining each columns before hand in target datastore. Cant ODI take it from the oracle table itself ?

    Addy,
    A CKM is a Check KM which is used to validate data and log errors. It is not going to assist you in data movement. You will need an LKM SQL to File append as answered in another thread.
    Assuming that you have a one to one mapping, to make things simpler you can duplicate the Oracle based model and create a file based model. This will take all the column definitions from the Oracle based model.
    Alternatively, you can also use an ODI tool odiSQLUnload to dump the data to a file
    HTH

  • How to specify which cert to use for software virt server?

    Is there a way to specify which certificate to use for each software virtual server? So, for example a user hitting https://somewhere.com would get the certificate for somewhere.com while the virtual server https://somewhereelse.com would use the certifcate with the name somewhereelse.com in it?

    No, this is not possible due to limitations of the underlying protocols.
    HTTP requests are sent over TCP connections which deal with IP addresses and port numbers (i.e. hardware virtual server properties), not hostnames (i.e. software virtual server properties). The HTTP protocol adds software virtual server support by allowing a client to identify the hostname (e.g. "www.iplanet.com") of the server it wishes to communicate with. This is achieved by including a "Host:" header with each HTTP request.
    Unfortunately, the SSL/TLS protocols require that the web server present its SSL/TLS certificate BEFORE the client sends its HTTP request. Since the software virtual server information is contained in the HTTP request, it is not possible for the server to select different certificates for different software virtual servers.
    You will need to use hardware virtual servers (i.e. virtual servers that have different IP addresses and/or port numbers) if you wish to use distinct SSL/TLS certificates.

  • After reopening Firefox does not remember which desktop was used for each window. Can you help, please.

    I'm using two displays and several desktops on my Mac (OS X 10.9.4).
    When I need to restart Firefox, it remembers to open windows from last session in correct display, but does not remember which desktop was used for each window. So when the application starts, it opens all windows on a desktop which is currently active instead of reopening them on desktops used during the last session. How to fix the issue?

    Hi Nerva,
    Thank you for your question, there is a add on I have been recommended to custom set up of opening windows in new monitors. It's called [https://addons.mozilla.org/en-US/firefox/addon/monitor-master/ Monitor Master].
    However, in regards to the session remembering which monitor the window was open in, in the profile folder there is a file that stores window positions and dimensions. It is called localstore.rdf.
    Please stay tuned for more investigation, as there are definitely bugs on file for similar issues. Pinpointing it is the hard part.

  • Which cable should use for Sony DV connect to iMac ?

    Which cable should use for Sony DV(IEEE 1394)connect to iMac ?

    If your iMac has just the FireWire 800 connection, you will need the 9 pin to 4 pin cable.
    http://www.cwol.com/firewire/firewire-800-1394b-cables.htm
    If your iMac has the FireWire 400 connection, you will need the 6 pin to 4 pin cable.
    http://www.radtech.us/Products/ProCableFW400800.aspx
    Links are to illustrate examples. You should be able to pick them up at most computer stores.

  • I have a Comcast system and am going through a Bose amp for sound.  The comcast box has an HDMI port which I've used for the Apple TV connection.  Nothing works! Help.

    have a Comcast system and am going through a Bose amp for sound.  The comcast box has an HDMI port which I've used for the Apple TV connection.  Nothing works! Help.

    Thanks.  Thought that would be the solution but for my wall mounted TV it's going to be a problem but many thanks for your reply.....

  • Which function is used for  adding days to given month

    which function is used for  adding days to given month

    Hi Jagrut,
    Good ... Check out the following examples
    <b>Get a date</b>
    DATE_GET_WEEK Returns week for a date
    WEEK_GET_FIRST_DAY Returns first day for a week
    RP_LAST_DAY_OF_MONTHS Returns last day of month
    FIRST_DAY_IN_PERIOD_GET Get first day of a period
    LAST_DAY_IN_PERIOD_GET Get last day of a period
    RP_LAST_DAY_OF_MONTHS Determine last day of month
    <b>Date calculations</b>
    DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
    DATE_IN_FUTURE Calculate a date N days in the future.
    RP_CALC_DATE_IN_INTERVAL Add days/months to a date
    RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
    SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
    MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
    DATE_CREATE Calculates a date from the input parameters:
    Example: DATE_CREATE
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
       anzahl_jahre  = 1
       anzahl_monate = 2
       anzahl_tage   = 3
       datum_ein     = '20010101'
    IMPORTING
       datum_aus     = l_new_date.
       Result:
       l_new_date = 20020304
    Example: MONTH_PLUS_DETERMINE
    data: new_date type d.
    CALL FUNCTION 'MONTH_PLUS_DETERMINE'
    EXPORTING
    months = -5 " Negative to subtract from old date, positive to add
    olddate = sy-datum
    IMPORTING
    NEWDATE = new_date.
    write: / new_date.
    <b>Hollidays</b>
    HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
    HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the
    date is a holiday by checking the parameter HOLIDAY_FOUND.
    Example: HOLIDAY_CHECK_AND_GET_INFO
    data: ld_date                 like scal-datum  default sy-datum,
          lc_holiday_cal_id       like scal-hcalid default 'CA',
          ltab_holiday_attributes like thol occurs 0 with header line,
          lc_holiday_found        like scal-indicator.
    CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
      EXPORTING
        date                               = ld_date
        holiday_calendar_id                = lc_holiday_cal_id
        WITH_HOLIDAY_ATTRIBUTES            = 'X'
      IMPORTING
        HOLIDAY_FOUND                      = lc_holiday_found
      tables
        holiday_attributes                 = ltab_holiday_attributes
      EXCEPTIONS
        CALENDAR_BUFFER_NOT_LOADABLE       = 1
        DATE_AFTER_RANGE                   = 2
        DATE_BEFORE_RANGE                  = 3
        DATE_INVALID                       = 4
        HOLIDAY_CALENDAR_ID_MISSING        = 5
        HOLIDAY_CALENDAR_NOT_FOUND         = 6
        OTHERS                             = 7.
    if sy-subrc = 0 and
       lc_holiday_found = 'X'.
      write: / ld_date, 'is a holiday'.
    else.
      write: / ld_date, 'is not a holiday, or there was an error calling the function'.
    endif.
    Checking dates
    DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
    Converting dates
    DATE_CONV_EXT_TO_INT Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328 Can also be used to check if a date is valid ( sy-subrc <> 0 )
    Function to return literal for month
    he table you want to use is T247. You can also use the function MONTH_NAMES_GET.
    You can also try table T015M. It has the month number in it's key.
    Formatting
    DATUMSAUFBEREITUNG Format date as the user settings
    Other
    MONTH_NAMES_GET It returns all the month and names in repective language.
    Good Luck and thanks
    AK

  • Is there a custom function available which can be used for logging errors captured in a sp in a sql table

    Is there a custom function  available which can be used for logging errors captured in a sp during and after execution in a sql table?
    Basically we  would like to utilize such function  in every sp and log errors of each sp in a error log table
    Mudassar

    Thanks .
    I was able to write this however I am thinking I am missing something
    CREATE FUNCTION testfunction1()
    RETURNS @temp_error TABLE (
    id int identity(1,1),
    procedure_name varchar(255),
    line_number int,
    error_number int,
    error_message varchar(max),
    error_state int,
    error_severity int,
    occurence_datetime datetime default current_timestamp,
    user_name sysname default suser_name(),
    login_name sysname default suser_name()
    AS
    BEGIN
    insert @temp_error(procedure_name,line_number,error_number,error_message,error_state,error_severity)
    select error_procedure(),error_line(),error_number(),error_message(),error_state(),error_severity()
    RETURN;
    END;
    CREATE TYPE test_type AS TABLE(
    id int identity(1,1),
    procedure_name varchar(255),
    line_number int,
    error_number int,
    error_message varchar(max),
    error_state int,
    error_severity int,
    occurence_datetime datetime default current_timestamp,
    user_name sysname default suser_name(),
    login_name sysname default suser_name()
    GO
    create proc usp_error_test
    @test_type AS test_type READONLY
    as
    begin
    begin try
    select 1/0
    end try
    begin catch
    select * from testfunction1(@test_type)
    end catch
    end
    Mudassar

  • Which frame is used for movie preview?

    Which frame is used for a home movie preview, takin with an iPhone 4s?  I guess the question is, is there a way to specify the frame of the movie which is used for the preview?
    -Thanks

    I would have a look at
    Gallery
    Demo or at the site of a friend of mine
    http://www.schutte.name

  • Which dictionary is used for spell check.

    Hi,
    I wanted to find out which dictionary is used for spell check? Is it Miriam Webster? My product manager and myself are curious.
    Regards.
    Ram.

    Hi Ram,
    Its ApEx Dictionary.
    Thanks
    Rana

  • Which tool is used for database designing

    Hi,
    Can you please share which tool is used for database(Oracle) designing most
    Thanks

    Kim Berg Hansen wrote:
    Personally I use brain, pen and paper for designing/modelling - then simply write scripts to create those tables.Me too.
    But of course I realize that is not the way of a modern programmer :-)No, modern programmers rely less on the brain part.
    I have heard other people saying that the (now free) [url http://www.oracle.com/technetwork/developer-tools/datamodeler/overview/index.html]SQL Developer Data Modeler is helpful for modelling. I haven't any personal experience, though.
    I have used it to reverse engineer the design resulting from the brain / pen / paper / scripts process and produce pretty pictures for the modern programmers to try and understand. It works quite well for this.

  • I have a licence code for Adobe CS6 Master Collection which I'm using for more  than a year, suddeny I am in trial mode (all programs)  an it seems that this code is not accepted anymore. Help needed!!

    I have a licence code for Adobe CS6 Master Collection which I'm using for more  than a year, suddeny I am in trial mode (all programs)  an it seems that this code is not accepted anymore. Help needed!!

    Chat Now button near the bottom for Activation and Deactivation problems may help
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html

Maybe you are looking for

  • [SOLVED] Extra resolutions for games with Nvidia drivers

    When using the nouveau drivers, games and other such applications will allow me to select any resolution my screens (one 1920x1080, the other 1680x1050-- the latter of which is to the left of the first) will support, as well as 3600x1080, the combine

  • Importing jar files in Sun Java Studio

    Hi I am new to java and have recently installed Sun Java Studio Enterprise. As a part of assignment, I have been provided a jar file and use it. But i have not been able to load it into my program. How do i load it ?

  • Data load from DTP

    Dear All, I have loaded around 2 millions of records through DTP with parrell processing enabled. It has load by 250 data package. One of the data package in DTP monitor is in yellow state from long time and that was stopped at Write to Fact table st

  • Configure to add Timestamp

    I want to use add a (WS Security) Timestamp header element depending on the server I am connecting to. However there does not appear to be a javax.net.ssl property to set when to use a timestamp or not? The web service in question is already picking

  • I keep getting network timed out errors when downloading iPad software

    How do I download ios5 without getting network timed out errors?