DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Get image's width and height faster

    Hi,
    I have problem how to get image's width and height (represented by file.jpg) faster.
    Using BufferedImage's getWidth() or getHeight() methods is very slow cause I have to read the whole image via ImageIO.read().

    Is there a way how to get image's height and width much faster ?

    Thank you for your advices.

  2. #2
    Join Date
    Nov 2005
    Posts
    9
    I hope this helps:

    Toolkit tk=Toolkit.getDefaultToolkit();
    IMG=tk.getImage(".\\background.jpg");

    MediaTracker mt = new MediaTracker(this);
    mt.addImage(IMG,0);
    try{
    mt.waitForAll();
    }catch(InterruptedException e)
    {System.out.println(e.getMessage());};

    //now IMG.getWidth, IMG.getHeight see documentation of java.awt.Image class

Similar Threads

  1. Replies: 1
    Last Post: 02-05-2003, 12:08 PM
  2. Replies: 1
    Last Post: 01-25-2002, 11:11 AM
  3. font height & width
    By Shiva Prasad in forum VB Classic
    Replies: 14
    Last Post: 01-09-2002, 06:03 PM
  4. font height & width
    By Shiva Prasad in forum VB Classic
    Replies: 0
    Last Post: 01-09-2002, 07:43 AM
  5. Height and Width of any Window ....
    By Sunil in forum VB Classic
    Replies: 4
    Last Post: 08-14-2000, 07:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links