Getting the bounds of a drawn image on a panel

Hello, I have a problem with getting the bounds of a drawn image on a panel...Since it is drawn as graphics, i tried getClipBounds and since my class extends JPanel i tried to get the bounds from the panel but neither of them worked properly. It only gets the bounds of a jframe that contains the panel.Then i tried to put the panel in a layeredpane and then a container; but this time the image disappeared completely. Hope someone can help or tell me what I am doing wrong. Thanks in advance. Here is the code below:
By the way what I am trying to do in this code is basically zooming the image in and out by dragging or the mouse wheel. But I need to get the bounds so that I can use this.
* To change this template, choose Tools | Templates
* and open the template in the editor.
* @author Admin
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
public class ZoomDemo extends JPanel {
AffineTransform tx = new AffineTransform();
String imagePath = "D:/Documents and Settings/Admin/Belgelerim/tsrm/resim.jpg";
Image image = Toolkit.getDefaultToolkit().getImage(imagePath);
int width = image.getWidth(this);
int height = image.getHeight(this);
int scrwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
int scrheight = Toolkit.getDefaultToolkit().getScreenSize().height;
double zoomfac = 1.0;
int xAdj;
int yAdj;
int prevY;
double scale = 1.0;
Point pt;
public static int x;
public static int y;
public static int w;
public static int h;
public ZoomDemo() {
this.addMouseWheelListener(new ZoomHandler());
this.addMouseListener(new ZoomHandler());
this.addMouseMotionListener(new ZoomHandler());
  repaint();
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.drawImage(image, tx, this);
// x =    (int) g2.getClipBounds().getX();
// y=     (int) g2.getClipBounds().getY();
// w=     (int) g2.getClipBounds().getWidth();
// h=     (int) g2.getClipBounds().getHeight();
// System.out.println(x+" "+y+" "+w+" "+h);
//  public int getRectx(){
//    return x;
//public int getRecty(){
//    return y;
//public int getRectw(){
//    return w;
//public int getRecth(){
//    return h;
private class ZoomHandler implements MouseWheelListener,MouseListener, MouseMotionListener {
public void mousePressed(MouseEvent e){
    System.out.println("Mouse Pressed");
xAdj = e.getX();
yAdj = e.getY();
prevY = getY();
public void mouseDragged(MouseEvent e){
       System.out.println("Mouse Dragged");
boolean zoomed = false;
if(e.getY()<prevY){
     zoomfac = zoomfac + 0.1;
     prevY = e.getY();
     zoomed = true;
else if(e.getY()>prevY){
     zoomfac = zoomfac - 0.1;
     prevY = e.getY();
     zoomed = true;
   scale = zoomfac;
Point2D p1 = new Point((int)xAdj-(width/2),(int)yAdj-(height/2));
Point2D p2 = null;
try {
p2 = tx.inverseTransform(p1, null);
} catch (NoninvertibleTransformException ex) {
// should not get here
ex.printStackTrace();
return;
tx.setToIdentity();
tx.translate(p1.getX(), p1.getY());
tx.scale(scale, scale);
tx.translate(-p2.getX(), -p2.getY());
tx.transform(p1, p2);
ZoomDemo.this.revalidate();
ZoomDemo.this.repaint();
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
Point2D p1 = e.getPoint();
Point2D p2 = null;
try {
p2 = tx.inverseTransform(p1, null);
} catch (NoninvertibleTransformException ex) {
// should not get here
ex.printStackTrace();
return;
scale -= (0.1 * e.getWheelRotation());
scale = Math.max(0.1, scale);
tx.setToIdentity();
tx.translate(p1.getX(), p1.getY());
tx.scale(scale, scale);
tx.translate(-p2.getX(), -p2.getY());
ZoomDemo.this.revalidate();
ZoomDemo.this.repaint();
        public void mouseClicked(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet.");
        public void mouseReleased(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet.");
        public void mouseEntered(MouseEvent e) {
           // throw new UnsupportedOperationException("Not supported yet.");
        public void mouseExited(MouseEvent e) {
           // throw new UnsupportedOperationException("Not supported yet.");
        public void mouseMoved(MouseEvent e) {
           // throw new UnsupportedOperationException("Not supported yet.");
public static void main(String[] args) {
//SwingUtilities.invokeLater(new ZoomDemo());
int scrwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
int scrheight = Toolkit.getDefaultToolkit().getScreenSize().height;
JFrame f = new JFrame("Zoom");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(scrwidth , scrheight);
//JLayeredPane lp = new JLayeredPane();
//f.add(lp);
ZoomDemo zd = new ZoomDemo();
zd.getBounds();
f.add(zd);
//int x = (int) zd.getX();
//int y = (int) zd.getY();
//int w = (int) zd.getWidth();
//int h = (int) zd.getHeight();
//System.out.println(x+" "+y+" "+w+" "+h);
//zd.setBounds(x ,y ,w ,h );
//lp.add(zd, JLayeredPane.DEFAULT_LAYER);
//f.setLocationRelativeTo(null);
f.setVisible(true);
//lp.setVisible(true);
//zd.setVisible(true);
}Edited by: .mnemonic. on May 26, 2009 11:07 PM
Edited by: .mnemonic. on May 27, 2009 11:00 AM

You'll need a stable point in the component to track and orient to the scaling transform(s).
From this you can construct whatever you need in the way of image location and size.
Let's try a center&#8211;of&#8211;image tracking point:
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
public class ZD extends JPanel {
    BufferedImage image;
    Point center;
    AffineTransform at = new AffineTransform();
    Point2D.Double origin = new Point2D.Double(0,0);
    public ZD(BufferedImage image) {
        this.image = image;
        center = new Point(image.getWidth()/2, image.getHeight()/2);
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                            RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        g2.drawRenderedImage(image, at);
        g2.setPaint(Color.red);
        g2.fill(new Ellipse2D.Double(origin.x-1.5, origin.y-1.5, 4, 4));
        g2.setPaint(Color.blue);
        g2.fill(new Ellipse2D.Double(center.x-1.5, center.y-1.5, 4, 4));
    private void setTransform(double scale) {
        // keep image centered over Point "center"
        double x = center.x - scale*image.getWidth()/2;
        double y = center.y - scale*image.getHeight()/2;
        origin.setLocation(x, y);
        at.setToTranslation(x, y);
        at.scale(scale, scale);
    public static void main(String[] args) throws java.io.IOException {
        java.net.URL url = ZD.class.getResource("images/hawk.jpg");
        BufferedImage image = javax.imageio.ImageIO.read(url);
        ZD test = new ZD(image);
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add(test);
        f.setSize(500,500);
        f.setLocation(100,100);
        f.setVisible(true);
        test.addMouseListener(test.mia);
        test.addMouseMotionListener(test.mia);
    /** MouseAdapter okay in j2se 1.6+ */
    private MouseInputAdapter mia = new MouseInputAdapter() {
        final double SCALE_INC = 0.05;
        final int SCALE_STEP = 20;
        double scale = 1.0;
        double lastStep;
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            center.setLocation(p);
            //System.out.printf("center = [%3d, %3d]%n", p.x, p.y);
            setTransform(scale);
            repaint();
        public void mouseDragged(MouseEvent e) {
            // scale up/down with relative vertical motion
            int step = (e.getY() - center.y)/SCALE_STEP;
            if(step != lastStep) {
                scale += SCALE_INC*((step < lastStep) ? -1 : 1);
                //System.out.printf("step = %3d  scale = %.3f%n", step, scale);
                setTransform(scale);
                lastStep = step;
                repaint();
}

Similar Messages

  • How to get the bounds of single char?

    How to get the bounds of single char in text frame?
    Thanks

    I also think there is not an exiting function which can get it, but we can work around. Can you give some ideas to work around it?

  • Get the icc profile of an image

    Hi all,
    I'm looking for a way to get the icc profile of an image in a PDF.
    I already know the tools like Acrobat preflight … But I only can get that my PDF contents RVB images or not.
    I'm looking for a tool to return the ICC profile of all images (s'RGB, Adobe 1988, etc.).
    Have anyone an ideas?
    Thanks a lot.
    Bye

    Hi,
    I have an other question …  Sorry
    I use this tool and it help me a lot … But I still can't get the icc profil name.
    For example: the inspector return CMYK device but I would like to have Fogra 27, ISO coated v2, Swop etc.
    Do you have an ideas?

  • How to get the copyright information for an image?

    How would I get the copyright data from an image in the DAM?

    Assuming you are using image component[1] on a page and copyright is a string.    As a sample you could use [2] to get the copyright information.  I am not well versed with the API as there might be an better option to implement. But this just gives you an idea for the information you were looking for.
    [1] /libs/foundation/components/image/image.jsp
    [2]
    Node refNode = resource.getResourceResolver().getResource(ResourceUtil.getValueMap(resource).get("fileRe ference","")).adaptTo(Node.class);
    String copyRight = refNode.getNode("jcr:content/metadata").getProperty("dc:rights").getString() ;

  • Getting the bounds of a windows

    Hello all,
    I have a jpanel application that i'm creating and i need to take -in some way- the bounds of the panel window (the window that my drawings etc are being displayed). I've tried the "getBounds" method returning a rectangle but all the values of that rectangle were 0. Do you have an idea how to get the bounds of the window at any moment i need them?
    Friendly yours,
    -John

    JFrame.getBounds() works fine for me. Your frame must of course be visible.

  • Getting the Bounds of a String in a nonGui App.

    Hi Guys,
    I want to use the getStringBounds method of the FontMetrics object and for accessing the FontMetrics instance, I need to have a gui (in the paintcomponent method). Since I'm working on a commandline application, how can I obtain the FontMetrics instance ?
    I tried the following for returning the width of a string in pixels and it
    returned zero ?!!!.
    Toolkit.getDefaultToolkit ().getFontMetrics ( new Font ( "arial", 12, Font.PLAIN ) ).stringWidth ( "Hello" );
    I appreciate your comments :-)
    Ali Salehi

    Thanks for your answer,
    The program is not going to write anything in console. It generates SVG files
    which contains the figures. For putting a multi-lined text in a
    nice looking rectangle, I need to set the size of the rectangle in advance.
    And for setting the size of the rectangle, I need to measure the
    bounds of the text (which is going to be surrounded by the rectangle).
    The DebugGraphics looks nice but it has two problems :
    1. Heavy to instantiate. Is there any lightweight alternative.
    2. Doesn't handle the Line formatting.
    It is possible to do simple text formatting (by \t and \n) using simple
    regular expressions and then getting the bounds using DebugGraphics.
    But, is there any other more interesting solution available ?
    Cheers,
    Ali Salehi

  • How do i get the code to register Pixillion Image converter? [was:glory614]

    how do i get the code to register Pixillion Image converter

    That's not Adobe software.
    You'll need to go to the maker's website and get your code from them
    http://www.nchsoftware.com/imageconverter/

  • Recently moved and installed ATT DLS - I use their wireless router and connectted my airport express - Now I'm getting the Blue ? on some images

    Recently moved and installed ATT DLS - I use their wireless router and connectted my airport express - Now I'm getting the Blue ? on some images - and at times - videos don't load.  I've increased / deleted Cache.  Suggestions? Misconfig?  Could it be possible my configuration from MacBook to router isn't correct?
    Thanks!

    JG,
    Thanks for the info.
    Couple of questions. I found an apple support document on this topic that opened with this line:
    "AirPort Express and all AirPort Extreme base stations can use WDS. Earlier AirPort base stations can't."
    If the TC is an airport extreme base station, why can't this work to extend the network? I think I misunderstand. Here is the full article:
    http://support.apple.com/kb/HT2044?viewlocale=en_US
    If I buy a new airport extreme, set it to wireless-n only as my main router, am I correct that my existing time capsule could be used as a bridge if plugged in upstairs?
    Final question (and that should do it), could I take this old airport express, plug it in upstairs using the ethernet connection, and just create a separate wireless network to use with a different name?
    I'd like to keep one network if possible but just kicking around short term solutions.
    Thanks again.

  • Save only the bounding box region of image as png?

    Hi,
    I'd like to save each layer's item as png.
    If possible, i'd like save only the bounding box of image(of an item), and the corresponding bounding box's origin/size info(relative to artboard's origin) somewhere as text file.
    To do this,
    I need to be able to get a bounding box of an item.
    and possibly artboard's origin. (because I'm not sure where a bounding box's coordinate's origin is).
    Thank you in advance

    If I understand you correctly you have one table with a bunch of yes/no values (SA, SC, SS, etc.).  Then for each record in that table you want to output a string listing all the fields from the first table which = yes (i.e are checked).  Perhaps
    the following code would get you started:
    Sub JimNeal()
        Dim strProcedure_Value As String
        Dim rst As DAO.Recordset
        Dim rstOut As DAO.Recordset
        Set rst = DBEngine(0)(0).OpenRecordset("TableWithCheckboxes")
        Set rstOut = DBEngine(0)(0).OpenRecordset("OutputTable")
        Do Until rst.EOF
            strProcedure_Value = ""
            If rst!SA Then strProcedure_Value = strProcedure_Value & "Surface Area,"
            If rst!SC Then strProcedure_Value = strProcedure_Value & "Surface Contour,"
            '... etc
            If rst!SS Then strProcedure_Value = strProcedure_Value & "Steep Slope,"
            rst.MoveNext
            ' Strip off final comma
            If Len(strProcedure_Value) > 0 Then strProcedure_Value = Left(strProcedure_Value, Len(strProcedure_Value) - 1)
            ' Output the string to your output table
            rstOut.AddNew
            rstOut!Procedure_Value = strProcedure_Value
            rstOut.Update
        Loop
        rst.Close
        rstOut.Close
        Set rst = Nothing
        Set rstOut = Nothing
    End Sub
    -Bruce

  • Is there any way to get the height/width of an image before importing it in the indesign document.

    Hi All,
    I need to obtain an image's attributes such as dimensions (height, width in pixels) without placing image in indesign document.
    I have full path of the image (say abc.jpg is stored at c:\my pic\abc.jpg).
    I have obtained the IDFile for this image, tried getting size using GetFileSize() which correctly return size in bytes.
    Is there any way to get the height/width of image without importing it in the indesign document.
    Please, give me some hints. I have spent quite a lot time digging in CHM. I have searched in FileUtils, IDFile API's but found no method which serves this purpose.
    At this point I am clueless where to search next.
    Any help will be appriciated.
    Just a point to mention, I am able to get image height and width for an image in indesign doc though Its not my requirement.
    Thnx,
    D.

    You might be able to examine the contents of the PlaceGun after calling kImportAndLoadPlaceGunCmdBoss without actually placing the image in a document. Not sure, but would be worth looking at.
    Otherwise you will probably have to write platform specific code, ideally with a generic platform-independant wrapper (see SDKSamples/paneltreeview/PlatformFileSystemIterator).
    For the Mac, look at CGImageGetWidth() etc., not sure what the best option is for windows.
    Perhaps Quicktime could provide you with a platform independant solution.

  • How to get the bound object of an external table with OMB

    Hello,
    I try to find it but without success. So may be one of you, know this secret information.
    I want to synchronize with the help of an OMB script my external tables.
    OMBSYNCHRONIZE FLAT_FILE '/MY_PROJECT/MY_FLAT_FILE_MODULE/MY_FLAT_FILE' RECORD 'MY_RECORD' TO EXTERNAL_TABLE 'MY_EXTERNAL_TABLE' \
    USE (RECONCILE_STRATEGY 'REPLACE', MATCHING_STRATEGY 'MATCH_BY_OBJECT_ID')For this purpose, I need to know the bound object. When you synchronize with the help of the GUI, you see it easily.
    Example:
    /MY_PROJECT/MY_FLAT_FILE_MODULE/MY_FLAT_FILE/MY_RECORDI searched in the properties of the external table and I don't see a BOUND OBJECT property.
    OMBDESCRIBE CLASS_DEFINITION 'EXTERNAL_TABLE' GET PROPERTY_DEFINITIONS
    BAD_FILE_LOCATION BAD_FILE_NAME BUSINESS_NAME DATA_FILES DEPLOYABLE DESCRIPTION
    DISCARD_FILE_LOCATION DISCARD_FILE_NAME ENDIAN GENERATE_ERROR_TABLE_ONLY GENERAT
    ION_COMMENTS LOAD_NULLS_WHEN_MISSING_VALUES LOG_FILE_LOCATION LOG_FILE_NAME NLS_
    CHARACTERSET NUMBER_OF_REJECTS_ALLOWED PARALLEL_ACCESS_DRIVERS PARALLEL_ACCESS_M
    ODE REJECTS_ARE_UNLIMITED SHADOW_TABLESPACE SHADOW_TABLE_NAME STRING_SIZES_IN TR
    IM UOIDThen I try the BOUND_OBJECT cached properties of a mapping operator but no luck.
    OMBRETRIEVE EXTERNAL_TABLE 'MY_EXTERNAL_TABLE' GET BOUND_OBJECT
    OMB00001: Encountered BOUND_OBJECT at line: 1, column: 56. Was expecting one of:
    "PROPERTIES" ...
        "REF" ...
        "REFERENCE" ...
        "COLUMN" ...
        "DEFAULT_LOCATION" ...
        "FLAT_FILE" ...
        "RECORD" ...
        "COLUMNS" ...
        "DATA_FILES" ...
        "DATA_RULE_USAGES" ...I have already the file and the record with the FLAT_FILE and RECORD properties
    OMBRETRIEVE EXTERNAL_TABLE  'MY_EXTERNAL_TABLE'  GET FLAT_FILE
    OMBRETRIEVE EXTERNAL_TABLE  'MY_EXTERNAL_TABLE'  GET RECORDBut how can I get the flat file module:
    MY_FLAT_FILE_MODULEDoes anybody know how OWB retrieve this information ?
    Thanks in advance and good day
    Nico
    Edited by: gerardnico on Jan 13, 2010 12:08 PM
    Change get the location by get the flat_file_module

    Yes, Oleg. It's what's worried me.
    The BOUND_OBJECT property of a table operator is not in the API.
    OMBDESCRIBE CLASS_DEFINITION 'TABLE_OPERATOR' GET PROPERTY_DEFINITIONS
    ADVANCED_MATCH_BY_CONSTRAINT AUTOMATIC_HINTS_ENABLED BOUND_NAME BUSINESS_NAME CO
    NFLICT_RESOLUTION DATABASE_FILE_NAME DATABASE_LINK DATA_COLLECTION_FREQUENCY DAT
    A_RULES DB_LOCATION DEBUG_BOUND_NAME DEBUG_DB_LOCATION DESCRIPTION DIRECT ENABLE
    _CONSTRAINTS ERROR_SELECT_FILTER ERROR_SELECT_ROLL_UP ERROR_TABLE_NAME EVALUATE_
    CHECK_CONSTRAINTS EXCEPTIONS_TABLE_NAME EXTRACTION_HINT IS_TEMP_STAGE_TABLE JOIN
    RANK KEYS_READONLY LOADING_HINT LOADING_TYPE MATCH_BY_CONSTRAINT OPTIMIZE_MERGE
    PARTITION_NAME PEL_ENABLED PRIMARY_SOURCE RECORDS_TO_SKIP REPLACE_DATA ROW_COUNT
    ROW_COUNT_ENABLED SCHEMA SINGLEROW SORTED_INDEXES_CLAUSE SUBPARTITION_NAME TARG
    ET_FILTER_FOR_DELETE TARGET_FILTER_FOR_UPDATE TARGET_LOAD_ORDER TEMP_STAGE_TABLE
    _EXTRA_DDL_CLAUSES TEST_DATA_COLUMN_LIST TEST_DATA_WHERE_CLAUSE TRAILING_NULLCOL
    S TRUNCATE_ERROR_TABLE UOID USE_LCR_APIThen I was wondering if anyone knew a little bit the same hidden property but to get the flat file source object of an external table.
    Cheers
    Nico

  • Getting the filename of a placed image inside a smart object

    Hi
    I'm wondering if I can get any help with a problem I'm trying to overcome for a friend of mine.
    My friend is a photographer who does a lot of schhols work (pupil portraits) and wants to create a little document similar to this (very simplified) version:
    I'm trying to help him to create a batch process so that he can make this take up much less of his time!
    Here's where I've got to so far. I've created the layout above which is essentially a smart object (from an external file) manipulated in a couple of ways.
    The workflow as I see it at the moment (although I'm wide open to suggestions, and I'm having a bit of Friday brain) is this: I generate an action that replaces the content of the external file with the contents of (each file in his incoming list, sequentially).
    That file then comes back into the layout above and a new (flattened) copy is saved out from there.
    Rinse and rerpeat through the list of incoming files.
    I can just about make that bit happen using actions, but here's what I can't get - the filename of the incoming file (the one that's placed in the smart object). Can I can use a modified version of the AddFileName script to generate a text layer based on the filename of the placed contents in the smart object? Does any of that make sense? I'm reading this back to myself and even I'm not sure! ho ho.
    My lack of logic/coherent sentence structure here is what probably holds me back in any eforts I have made in getting into scripting.
    I'd appreciate any help that could be offered.
    Thanks.
    Fenton

    Ah - alas it sems not to be. I think I am going to have to come up with a different workflow and by extension, solution. My current thinking is that I need to have an input folder for the images to be used in the layout, and an output folder for the results to be saved into, along with the layout.psd (as above) all housed in the same folder. Then I need (help) to write a script that does the following:
    Checks that the layout document is open (that bit is easy enough)
    if(documents.length==0){
       alert("You need to have your layout template open (-layout.psd-)")
    }else{
        // Do next bit here - and what I'm trying to do is described below.
        // Hopefully by typing it out I might start to get it straight in my head
        // Any help with any part of this process is greatluy appreciated
        // I'm trying to learn!
    Then what I think the script needs to do is tocheck the contents of the input folder and find out how many files are in it then set this as a variable, to set the length of a loop, maybe? Or should it load the filenames as an array and work through them sequentially?
    Once that information is established, there is a smart object on the first layer that needs to be updated with the contents of the first file - my thinking s that this is done by the script opening each image, and then copy/pasting into the smart object, merging down (so I don't end up with an enormous multi-layered file). My reason for thinking this would be a good idea would be that I could just run a quick check to make sure that no landscape pics have sneaked in there and if they have, rotate them (which again, is pretty easy as even I could do that bit, too).
    doc = activeDocument;
                if (doc.height < doc.width) {
                  doc.rotateCanvas(90);
                } else {
                  // Carry on
    This will update all of the smart object instances throughout the layout template.
    Then the text underneath the main image needs to be updated with the filename of the file that has been pasted in the smart object, and after that a [flattened] copy saved out to an output folder.
    Rinse and repeat for the remaining images in the input folder.
    Any thoughts?
    Thanks
    Fenton

  • Getting the dimensions of an BLOB image.

    All,
    Is anyone aware of a means thru which one can get the size of an image stored in BLOB format?
    Basically I have an application that allows images to be uploaded but I want to make sure that they are only so many pixels by so many pixels. I'm hoping some brilliant person out there may have written a PL/SQL package that would have some functions for this kind of thing...
    Regards,
    Dan

    No, it's PL/SQL. ORDSYS is the schema for Oracle interMedia; ORDImage is the abstract type for still images; and getProperties is a static method implemented by the type.
    This has come up a few times before on the forum - among them Re: height and width of image loaded into blob?. Look at this and search the forum for "ORDImage" and you should find what you're looking for.

  • How many ways are there to get the Width/Height of an image ?

    I am currently using the following code to get the width and hight of an image :
    BufferedImage Buffered_Image=ImageIO.read(new File(Image_Path));
    int Image_Width=Buffered_Image.getWidth();
    int Image_Height=Buffered_Image.getHeight();I don't need to get the image (*.jpg, *.gif, *.png), just want to know it's dimensions. I wonder how many other ways are available to do the same thing in a Java application ?
    Frank

    Ni_Min wrote:
    That's what I thought. I am asking because I hit a wall and am trying to find a different approach.Yeah, if you only have one file type you can probably write the code to read the header in 20 min.
    I packed my programs into an executable Jar file which I can run and access images on my C:\ drive, everything worked fine until I tried to experiment with something new. I know that I can force JVM to pre-load all my java classes just after it starts, so I deleted the jar right after the program pre-loaded all my classes and tried to see if it would work, but now I get a null pointer error when it tried to get the width/height of an existing image, because ImageIO.read return null. ( The same image is still on my C:\ drive )Sounds like a strange thing you're doing here. What's the point of this?
    So I wonder why it makes a difference after I deleted the jar, what was the problem ( or do I need to pre-load another class related to ImageIO.read ? ), and maybe if I use something else other than the ImageIO.read to get the width/height, I can bypass the problem.I dunno why you need to do this preload stuff and/or delete anything. I'd say leave the JVM and the app alone if possible.

  • 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

Maybe you are looking for

  • Error in Process Order Creation

    Hi Experts, I am facing a problem while creating a process Order in COR1 I have got an error reading Master Data which is No task list for select.ID 04 for auto. task list selection found Please Help me out. Thanking You In advance.

  • NAM2 5.1(2) Capture to File Limitation?

    I recently upgraded my NAM2 from v4.2(1) to 5.1(2). It now appears that I can only run a single concurrent capture when the destination is the disk. This has occurred on multiple NAMs so I assume it's either operating as designed or I downloaded faul

  • Problems capturing some DV tapes

    I am capturing lots of mini DV tapes and some High 8 tapes directly from the camera using Firewire. Over half the tapes go in fine and maybe 30-40% of the tapes stop at some point and say something about dropped frames and something about audio may n

  • RLDP enabled on WLC causes client drops?

    The release notes for WLC code 4.0.206.0 states, "Enabling RLDP may cause access points connected to the controller to lose connectivity with their clients for up to 30 seconds." Does anyone have more information about this? I don't like the word "ma

  • I'm still on 10.4.11... Anyone have the most "proficient" steps to get to LION???

    I'm trying to make the jump to Lion, yet want to make it with the fewest steps possible.  Any advice on what OSs must me installed in order to make the transition? Thank you!