Help needed : getting the size of an image

Seems that my first post didn't work.. so i try another time.
I'd like to get the size (width and height) of an image file, just using the path of that file.
Does anyone knows if there is an existing class that can allow me to, or does someone knows the way i should work on it
Thanks in advance

In java.awt.Image there are getWidth() and getHeight()
Klint

Similar Messages

  • Help with reducing the size of an image but keeping the quality

    Hello,
    I am wondering how do I resize an image but keep the quality. I am creating a folder design for work and I want to include 6 images on the back each of 156px x 118px.
    The images I have are slightly different in size but for example sake one of the images that I have is 225px x 158px. The quality is very poor when I reduce the size.
    I have tried changing the ppi to 72 and to 300, I have also tried resizing all in one go and in a number of goes and I have tried the bicubic sharpener but I have just had no luck with it.
    I am wondering if anyone can help with this,
    Thanks
    Tracy

    Hi Tracy,
    A couple of questions:
    I am creating a folder design for work...
    So this is printed? How large? Pixels are not a unit-of-measure for print.
    If for print, you are looking at ppi of 300 or higher AT PRINT SIZE.
    So, say you want a 3in x 4in picture. That would mean your original would have to be at least 900px X 1200px. (ie 300ppi x width, 300 ppi x height)
    If your original files are not at least that resolution.. . it is hard to add quality after the fact. Unless your are working with vector art.
    I have tried changing the ppi to 72 and to 300, I have also tried resizing all in one go
    Be sure to do that on copies of original. Keep in mind the PPI number by itself is completely meaningless. It only has use in describing a to be printed image when combined with the print size.

  • How to get the size of an image?

    yhanks

    try something like:
    // in case 'this' is a JComponent or something similar:
    MediaTracker mt = new MediaTracker(this);
    mt.addImage(myImg1, 1);
    mt.addImage(myImg2, 2);
    while (!(mt.checkAll(true))) {
      try {
        Thread.sleep(10);
      } catch (InterruptedException iex) { }
    // all loadedThis would load all images registered with the MediaTracker but also blocks execution of your program. You might want to start a different thread for this.
    cheers,
    kelysar

  • Getting the size of a jpeg image

    Hello,
    I'm looking for a way to get the size (height and width in
    pixel) of a jpeg file before actually loading the file.
    Is it possible ?
    Thanx.
    Vincent

    This is a flaw in Pages IMHO.
    As for many things the information and manipulating the properties is oblique to say the least.
    You have to do what you have done or do some calculations based on size, and known resolution.
    A way around might be to tag the image in the name with the actual pixel size.
    I work from my images marked in folders as vLoRes, LoRes, MedRes, HiRes, vHiRes and uHiRes.
    Given a basic requirement of a bare minimum 100 pixels/cm (roughly 254dpi) for commercial reproduction the images will cover (with bleed):
    vLoRes = A7
    LoRes = A6
    MedRes = A5
    HiRes = A4
    vHiRes = A3
    uHiRes = beyond A3
    But then I happen to be very systematic in the way I work. It is a useful skill I have taught in my studios. Unfortunately many designers, and users in general, are sloppy and short sighted.
    Peter

  • Does anyone know why video image in events section has a certain dimension and instead when I import same video in a clip, the size of video image is minor? Thanks for help

    Does anyone know why video image in events section has a certain dimension and instead when I import same video in a clip, the size of video image is minor? Thanks for help

    This may depend on your chosen encoding options for the Mails (MIME vs. Base64 or similar) and/or the mails being reduced in size and sliced up server side. Apple (and Google) do stuff like recompressing images when viewing mails on mobile devices from an Apple ID or Gmail account... You have to turn it off in their web frontends....
    Mylenium

  • How to set the size of an image

    hi,
    I have a database which contain an image. now i want to retrieve this image & want to show this image in my jsp page as user's defined size. I have following code. My following code shows the original size of an image. Now i want to see different size of this image. How is this possible? I know control the size of this image after saving this image
    in a file. but i want to control the size of this image without saving this image in a file? IS it possible ? Is there anybody can help me?
    Please help me.
    ResultSet rs = null;
    PreparedStatement ps=null;
         InputStream sImage=null;
         byte[] imagebyte=null;
         String var;
         String name=request.getParameter("RegName") ;
         String image =request.getParameter("ImageFile");
         out.println(name);
         out.println(image);
         out.println();
         ps=con.prepareStatement("insert into t_image (ID, Image) values(?,?);");
           File file =new File(image);
        FileInputStream in = new FileInputStream(file);
        ps.setInt(1,1234);
        ps.setBinaryStream(2,in,(int)file.length());
        ps.execute();  
        rs =stm.executeQuery("select Image from t_image where ID=1234");
        if(rs.next()) {
       imagebyte =rs.getBytes(1);
        response.reset();
        response.setContentType("image/jpeg");
        %>
    <%
    response.getOutputStream().write(imagebyte);
    %>
    <%
        response.flushBuffer();
    %>With regards
    Bina

    hi,
    I have a database which contain an image. now i
    want to retrieve this image & want to show this
    image in my jsp page as user's defined size. I have
    following code. My following code shows the original
    size of an image. Now i want to see different size
    of this image. How is this possible? I know control
    the size of this image after saving this image
    n a file. but i want to control the size of this
    image without saving this image in a file? IS it
    possible ? Is there anybody can help me?This has nothing to do with JDBC; you can only store and retrieve the image you have and there's no image manipulation functions in JDBC (nor should there be).
    I can see 2 options:
    1) serve the image file as is, but in the jsp that writes the html that contains the "<img>" tag that gets it, use the "height" and/or the "width" to scale the suppied image to presentation size you want.
    2) find some image manipulation code that will convert the image into the size you want
    Option 1 will work well if the problem you have is merely refining the image size for presentation. Option 2 is your only coice if it's the image files size itself you really want to change, not just it's appearance on a page.

  • How to decrease the size of an image (CS5)?

    I need help with how to reduce the size of an image to fit various smaller sizes.  E.g. 135 x 380mm, 254 x254mm etc mounted/matted. Therefore, the image must be made smaller than these sizes without losing quality and any part of the image. I am unable to crop to achieve these sizes since I need the full image. These photos were taken by using a Canon D450 camera and in both RAW & JPEG.
    Your help is much appreciated.

    You may want to use Image > Image size... and dial in the sizes you want.
    Set your units to mm in the dialog. Turn off resample and you can adjust the final print size.
    What I am showing you is called "scaling", changing the print size without throwing out pixels as resample would do. Your image is  intact. This is from CS6, but it should be about the same in CS5.
    Gene

  • How can I get the resolution of an image file in JSP?

    how can I get the resolution of an image file like jpg,gif,png in JSP ?

    Hii,
    If by the resolution, u mean size..this is how u can come to know....
    String add = "path/to/some.jpeg";
    javax.swing.ImageIcon chain = new javax.swing.ImageIcon(add);
    int height = chain.getIconHeight();
    int width = chain.getIconWidth();
    Hope that helps.
    regards
                   

  • When I try to print a photo downloaded from Facebook in iPhoto, I can't get the size I specify to print correctly. Example: 5x7 prints smaller than 5x7. What do I do to solve this problem?

    When I try to print a photo downloaded from Facebook in iPhoto, I can't get the size I specify to print correctly. Example: 5x7 prints smaller than 5x7. What do I do to solve this problem?

    Those pixel dimemsions have aspect ratios that are not the same as a 5 x7 print:
    1360 x 1360 = 1.0
    790 x 640 = 1.23
    2048 x 1366 = 1.5
    An 7 x 5 image = 1.4.
    So you'll need to crop the images to 5 x 7 before printing.  The first two images are a little light in the pixels to produce a high resolution 5 x 7 print. 
    Happy Holidays

  • Help to calculate the size of arraylist..........

    class hdrFileFilter extends FileFilter {
    private Hashtable filters = null;
    private Hashtable noextensionfilter = null;
    private String noextensionname=null;
    private String extensionname = null;
    private String description = null;
    private String fullDescription = null;
    private boolean useExtensionsInDescription = true;
    private String fname = null;
    public ArrayList noextensionarray=new ArrayList();
    private File x;
    int count=0;
    int counthdr=0;
    int i=0;     
         //all files are accepted.
    public hdrFileFilter()
         this.filters = new Hashtable();
         //Creates a file filter that accepts files with the given extension.
    public hdrFileFilter(String extension)
         this(extension,null);
         //Creates a file filter that accepts the given file type.
    public hdrFileFilter(String extension, String description)
         this();
         if(extension!=null)
         addExtension(extension);
         if(description!=null) setDescription(description);
    }      //Return true if this file should be shown in the directory pane,false if it shouldn't.
    public boolean accept(File f) {
         if(f != null) {
         if(f.isDirectory()) {
              return true;
         String extension = getExtension(f);
         if(extension != null && filters.get(getExtension(f)) != null)
              fname=f.getName();
              extensionname=fname.substring(0,fname.lastIndexOf('.'));
              counthdr+=1;
              return true;
         if(extension == null)
              noextensionfilter=new Hashtable(20);
              noextensionname=f.getName();          
              noextensionfilter.put(count,noextensionname);
              count+=1;
              if(noextensionfilter.get(count) == extensionname)
                   //noextensionarray=new ArrayList();
                   x=f;
                   noextensionarray.add(x);
                   System.out.println("file:" +noextensionarray.get(i));                //i++;
                   return true;               
         return false;
    [b]public int get_size()
         int xx=noextensionarray.size();
         return xx;
         System.out.println("size is:" + noextensionarray.size());
         //Return the extension portion of the file's name .
    public String getExtension(File f)
              if(f != null)
                   String filename = f.getName();
                   int i = filename.lastIndexOf('.');
                   if(i>0 && i<filename.length()-1)
                        return filename.substring(i+1).toLowerCase();
              return null;
         //Adds a filetype "dot" extension to filter against.
    public void addExtension(String extension)
         if(filters == null)
         filters = new Hashtable(20);
         filters.put(extension.toLowerCase(), this);
         fullDescription = null;
    public String getDescription()
              if(fullDescription == null)
                   if(description == null || isExtensionListInDescription())
                        fullDescription = description==null ? "(" : description + " (";
                        // build the description from the extension list
                        Enumeration extensions = filters.keys();
                        if(extensions != null)
                             Object nn=extensions.nextElement();
                             fullDescription += "." + nn;     
                             while (extensions.hasMoreElements())
                                  fullDescription += ", ." + nn;
                        fullDescription += ")";
                   else
                        fullDescription = description;
              return fullDescription;
    public void setDescription(String description)
         this.description = description;
         fullDescription = null;
    public void setExtensionListInDescription(boolean b) {
         useExtensionsInDescription = b;
         fullDescription = null;
              public boolean isExtensionListInDescription()
              return useExtensionsInDescription;
    } //end of hdrfilefilter
    class reference extends hdrFileFilter
    reference()
    here i need the size of noextensionarray array List
    I've used method get_size() for the calculation of niextensionarray List in above class which is marked as bold.
    since I've allocate memory to the array above the hdrFileFileter() so now the array list is showing the zero size of arraylist.
    PLS. help me to get the size of arraylist noextensionarray.

    Hello all,
    the code contain two classes
    1. hdrFileFilter: used to filter out files containing the extension .hdr and those files that haVE the same name as the header file has but with no extension.
    files that have no extension are stored in the arraylist "noextensionarray".
    2. Reference Class: this class is using the files that are stroed in the array List "Noextensionarray" one by one. for this I required the size of arraylist. I'm using the size of array through function get_size it gives the size=0;this function is defined in class hdrfilefilter.although it is diaplaying the name which are stored in arraylist on commad prompt.
    I appricate all the comments given regarding the solution of the problem.
    class hdrFileFilter extends FileFilter
         private Hashtable filters = null;
         private Hashtable noextensionfilter = null;
         private String noextensionname=null;
         private String extensionname = null;
         private String description = null;
         private String fullDescription = null;
         private boolean useExtensionsInDescription = true;
         private String fname = null;
         public ArrayList noextensionarray=new ArrayList();
         private File x;
         int count=0;
         int counthdr=0;
         int i=0;
         //all files are accepted.
         public hdrFileFilter()
              this.filters = new Hashtable();
         //Creates a file filter that accepts files with the given extension.
         public hdrFileFilter(String extension)
              this(extension,null);
         //Creates a file filter that accepts the given file type.
         public hdrFileFilter(String extension, String description)
              this();
              if(extension!=null)
              addExtension(extension);
              if(description!=null) setDescription(description);
         } //Return true if this file should be shown in the directory pane,false if it
    shouldn't.
         public boolean accept(File f)
              if(f != null)
                   if(f.isDirectory())
                        return true;
                   String extension = getExtension(f);
                   if(extension != null && filters.get(getExtension(f)) != null)
                        fname=f.getName();                         
              extensionname=fname.substring(0,fname.lastIndexOf('.'));
                        counthdr+=1;
                        return true;
                   if(extension == null)
                        noextensionfilter=new Hashtable(20);
                        noextensionname=f.getName();
                        noextensionfilter.put(count,noextensionname);
                        count+=1;
                        if(noextensionfilter.get(count) == extensionname)
                                  //noextensionarray=new ArrayList();
                                  x=f;
                                  noextensionarray.add(x);
                                  System.out.println("file:"
    noextensionarray.get(i)); //i+;
                                  return true;
              return false;
         public int get_size()
              int xx=noextensionarray.size();
              return xx;
              System.out.println("size is:" + noextensionarray.size());
    //Return the extension portion of the file's name .
         public String getExtension(File f)
              if(f != null)
                   String filename = f.getName();
                   int i = filename.lastIndexOf('.');
                   if(i>0 && i<filename.length()-1)
                        return filename.substring(i+1).toLowerCase();
                   return null;
    //Adds a filetype "dot" extension to filter against.
         public void addExtension(String extension)
              if(filters == null)
                   filters = new Hashtable(20);
              filters.put(extension.toLowerCase(), this);
              fullDescription = null;
         public String getDescription()
              if(fullDescription == null)
                   if(description == null || isExtensionListInDescription())
                        fullDescription = description==null ? "(" :
    description + " (";
                        // build the description from the extension list
                        Enumeration extensions = filters.keys();
                        if(extensions != null)
                             Object nn=extensions.nextElement();
                             fullDescription += "." + nn;
                             while (extensions.hasMoreElements())
                                  fullDescription += ", ." + nn;
                        fullDescription += ")";
                   else
                        fullDescription = description;
              return fullDescription;
         public void setDescription(String description)
              this.description = description;
              fullDescription = null;
         public void setExtensionListInDescription(boolean b)
              useExtensionsInDescription = b;
              fullDescription = null;
         public boolean isExtensionListInDescription()
              return useExtensionsInDescription;
    } //end of hdrfilefilter
    Class reference
    REQUIRED THE SIZE OF ARRAYLIST.
    }

  • How to get the size of the cuurrent illustration

    Sorry, I made a mistake before this one. The questios is this: can anybody tell me how can I get the size of the current illustration, (as oposed to the page size) in points. Something like 120 points wide and 87 points High?. What function do I need to call?

    From AI Function reference (included with CS2 SDK):
    AIDocumentSetup setup;
    error = sDocument->GetDocumentSetup(&setup);
    if (error) goto processError;
    writeDocumentSetup( &setup );
    The AIDocumentSetup record returns the following information:
    typedef struct {
    AIReal width, height;
    AIBoolean showPlacedImages;
    short pageView;
    AIReal outputResolution;
    AIBoolean splitLongPaths;
    AIBoolean useDefaultScreen;
    AIBoolean compatibleGradients;
    AIBoolean printTiles;
    AIBoolean tileFullPages;
    } AIDocumentSetup;

  • Dashcode: How do I get the name of an image in a website?

    I'm making a widget that gets the filename of an image on a website and it changes the value of some parts of the widget if the filename has a certain name. The only problem is that I don't know how to get the name of this image in the widget. Could somebody please help me?

    If I understand well, I think that the XMLHttpRequest object may help you. Please check the following link:
    http://developer.apple.com/internet/webcontent/xmlhttpreq.html
    Also, if you can program in Perl (or some other scripting language), you can use an external script to read the filename and send it to your Widget.
    Mihalis.

  • How to get the size of driver[C: or D:]

    Hi Friends,
    I have a query regarding to java..
    I want to get the name of all the drives that r connected to the System including network drives...
    and how to get the size of any system drive[For example C: or D: Drive].
    I want the output to be displayed like in the following format
    Device type size free Usage_Space
    for ex.
    C: NTFS 37.5Gb 30.5gb 7gb
    Output like as linux command df -h
    Edited by: KituPrash on Mar 4, 2009 3:29 AM

    Does this help for starters?
    File[] roots= File.listRoots();
    for (int i= 0; i< roots.length; i++)
         System.out.println(roots[i]+": "+roots.getTotalSpace());kind regards,
    Jos                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the size of the webpage?

    I am designing a program to
    analyse the webpage content.
    wondering how to get the size of
    the webpage including its image's
    size and etc. Thanks in advance.

    As i know , the getContentLength just return
    then number of characters of its HTML code.
    By knowing the length of the HTML code, is
    not possible for me to calculate its download
    time... i wonder is there any way to get the
    total size of the page including its image size,
    applet size, and etc... Thanks : )

  • How to get the size of the table

    Hi All,
    How to get the size of the table in Oracle 10g?
    Is there any script which needs to be run?
    Regards,
    Apoorv

    Hi All,
    Sorry but somehow the table user_segments is not populated in my case. But we have another table SYS.ALL_TABLES whose structure is given below. Would I be able to calculate the table size based on the columns given below:
    ColumnName     Data Type
    OWNER     VARCHAR2 (30 Byte)
    TABLE_NAME     VARCHAR2 (30 Byte)
    TABLESPACE_NAME     VARCHAR2 (30 Byte)
    CLUSTER_NAME     VARCHAR2 (30 Byte)
    IOT_NAME     VARCHAR2 (30 Byte)
    STATUS     VARCHAR2 (8 Byte)
    PCT_FREE     NUMBER
    PCT_USED     NUMBER
    INI_TRANS     NUMBER
    MAX_TRANS     NUMBER
    INITIAL_EXTENT     NUMBER
    NEXT_EXTENT     NUMBER
    MIN_EXTENTS     NUMBER
    MAX_EXTENTS     NUMBER
    PCT_INCREASE     NUMBER
    FREELISTS     NUMBER
    FREELIST_GROUPS     NUMBER
    LOGGING     VARCHAR2 (3 Byte)
    BACKED_UP     VARCHAR2 (1 Byte)
    NUM_ROWS     NUMBER
    BLOCKS     NUMBER
    EMPTY_BLOCKS     NUMBER
    AVG_SPACE     NUMBER
    CHAIN_CNT     NUMBER
    AVG_ROW_LEN     NUMBER
    AVG_SPACE_FREELIST_BLOCKS     NUMBER
    NUM_FREELIST_BLOCKS     NUMBER
    DEGREE     VARCHAR2 (10 Byte)
    INSTANCES     VARCHAR2 (10 Byte)
    CACHE     VARCHAR2 (5 Byte)
    TABLE_LOCK     VARCHAR2 (8 Byte)
    SAMPLE_SIZE     NUMBER
    LAST_ANALYZED     DATE
    PARTITIONED     VARCHAR2 (3 Byte)
    IOT_TYPE     VARCHAR2 (12 Byte)
    TEMPORARY     VARCHAR2 (1 Byte)
    SECONDARY     VARCHAR2 (1 Byte)
    NESTED     VARCHAR2 (3 Byte)
    BUFFER_POOL     VARCHAR2 (7 Byte)
    ROW_MOVEMENT     VARCHAR2 (8 Byte)
    GLOBAL_STATS     VARCHAR2 (3 Byte)
    USER_STATS     VARCHAR2 (3 Byte)
    DURATION     VARCHAR2 (15 Byte)
    SKIP_CORRUPT     VARCHAR2 (8 Byte)
    MONITORING     VARCHAR2 (3 Byte)
    CLUSTER_OWNER     VARCHAR2 (30 Byte)
    DEPENDENCIES     VARCHAR2 (8 Byte)
    COMPRESSION     VARCHAR2 (8 Byte)
    DROPPED     VARCHAR2 (3 Byte)

Maybe you are looking for

  • Possi. for ABAP code instead of JAVA Script for creating searachhelp in BSP

    Hi Consultants i have a doubt that is there a possibility to use ABAP coding in BSP object for creating search help instead of JAVA Script if so please reply me with the procedure or else with some sample coding.

  • G4 (gigabit ethernet) hard drive question

    so i am turning an old g4 450 mhz of mine into a file server with old hard drives of mine laying around. i put in 2 of my 250gb hard drives in where the zip drive and cd drive were giving myself a total of 4 hard dries my only problem is when i start

  • Keywords from previous import lost

    In prior versions, LR facilitated importing images from multiple cards by retaining the previous settings in the import dialog. In version 3.all, it clears out the keywords section. This means you have to retype all those keywords, with every single

  • Simultaneous writing of different DAQmx tasks to TDMS files

    Hi, I am using a 6368 to moniter several different voltage readings simultaneously on a circuit. I would like to have each of these channels sampling as close to the 2MS/s limit as possible, while writing the data to disk. From what I've gathered, it

  • HT1551 Audio issues on Apple TV

    I can hear the clicking of my remote , I can also get audio from airplay devices but I can't hear any of my Apple TV apps like Netflix or iTunes.  Any ideas?  Totally confused