How to get the formatName of an image?

Hi,
I'm trying to write a little class which gets as input an image file (gif, jpg or png) and outputs a resized version of it. My aim is to output allways an image having the same format like the input one. I saw that ImageIO.write accepts as parameter the String formatName.
The question is how can somebody get the formatName for the input-image?
Thanks,
IMIA

I'd like to have a method like this:
public static String resizeImg(String imgPath, Integer newWidth, Integer newHeight)
It gets as parameter the absolutePath to an image and the new width&height; it should resize the image and return me the absolute path to the resized image.
What I want is that in the case the imgPath points to a gif image the resized image should be a gif as well. If it's a jpg the resized img should be a jpg as well. The only one pb I have is to find out inside the resizeImg what format the imgPath image has, the rest would be clear.
Thanks for your help.

Similar Messages

  • IDVD quality update... how to get the best looking photo images on your TV

    To get the best quality photo slideshow (that looks the best on my TV)
    1) create the slideshow with music in "Photo to Movie" program
    2) send it to IDVD from "Photo to Movie"
    3) create the menu in iDVD
    4) make a disc image from iDVD (file - save as disk image) save on the desktop
    5) burn DVD at x2 in disc utilities on a Verbatim DVD-R disc
    ???? Any other suggestions to get a better quality product !!
    * special thanks to SDMacuser for all your help and prior posts.
    Cheers
    iMAC 5,1,Intel Core 2 Duo,2.16GHz   Mac OS X (10.4.8)  
    iMAC 5,1,Intel Core 2 Duo,2.16GHz   Mac OS X (10.4.8)  

    in search of the best looking photoslide show DVD to view on a TV..... a couple more questions
    if I understand some of the recent posts to get a clear picture:
    Question #1
    I need to import all of the photos into photoshop CS (or a similar product) and resize them to 1280 x 960 (4:3)ratio then open iDVD and import them.
    If I am doing Ken Burn effects then resize them to 2560 x 1920 and use "Photo to Movie" to create the slideshow then import into iDVD (to get a cool menu)
    can you just bring the images in from iphoto (in the same format that they were imported from the camera)?
    I am using a Nikon D70 6.0 megapixel
    Question #2
    If I burn the disc in iDVD... it is not as good as using Disk utility or Toast because of the burn speed (2X) ... is this correct?

  • 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

  • How to get the component as an image

    i want to save my component as an image.
    I add many components to a JPanel, write some string on it, etc etc.
    Then I want it whole to be added as an image. How can I do it?

    See:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=530815
    http://forum.java.sun.com/thread.jsp?thread=426455&forum=31&message=1898276
    http://forum.java.sun.com/thread.jsp?thread=443125&forum=20&message=1999960
    http://forum.java.sun.com/thread.jsp?thread=450369&forum=32&message=2044632
    http://forum.java.sun.com/thread.jsp?thread=475053&forum=20&message=2202147
    http://forum.java.sun.com/thread.jsp?thread=469584&forum=425&message=2165447
    http://forum.java.sun.com/thread.jsp?thread=481131&forum=57&message=2242633
    http://forum.java.sun.com/thread.jsp?thread=527767&forum=425&message=2534389
    http://forum.java.sun.com/thread.jsp?thread=514356&forum=57&message=2448607

  • 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.

  • Get the font names and image names in QXD

    Hi,
    How to get the font names and image name in Quarkxpress document file using java?.
    Is any third party packages for getting font n image names in QXD?
    thanks,
    nithya

    rtuck,
    I believe this may solve it:
    Open System Preferences and go to Accessibility. Next, select Display from the source list along the left, then check the box labelled Reduce transparency.
    It was first presented in this post #15 by TheUlser:
    https://forums.adobe.com/message/6854594#6854594

  • How to get the image stored in archieve link as an attachment in work item.

    Hi All,
    through transaction OAWD we are storing scanned images.
    Once this transaction is executed a workitem appears in the inbox of the initiator with the scanned invoice as attachment.
    When the user executes the work item FV60 screen is displayed where the user enters the data based on the scanned invoice attachment.
    After the user Parks the document the custom workflow triggers and a workitem appears in the inbox of an approver.
    Our requirement is that the scanned image should also appear as the attachment.
    Can you please suggest how to get the image stored in archieve link as an attachment in work item.
    Regards
    Shraddha

    Hi Martin,
    with every parked document a scanned image is linked.
    I need to create a link under objects and attachments in the work item, such that when the user clicks that link the image is displayed.
    At present the following functionality is available.
    The BO used is FIPP
    Objects and attachments:
    parkeddocument:AK0108500001252008.(via FIPP binding with WIOBJECT_ID)
    On clicking the link below objects and attachments: the parked document AK0108500001252008 opens in display mode.
    Now we want to have 2 links:
    parkeddocument:AK0108500001252008.
    image.
    When we click on the link image then the scanned invoice linked to the document should get opened.
    I am able to get the image id of the the image through  SAP_WAPI_GET__OBJECTS,
    export parameter leading_object provides the detail.
    But I am not able to figure out how to use it in my workflow to display it as an attachment.
    Hope this will give a better understanding of my question.
    can you please suggest as to how I should proceed with it.

  • How to get the local file system path of an image that loaded into the image component in cq5?

    Hi,
    I'm having hard time uploading image from filesystem where as drag and drop works.
    I'm not getting a path of image selected from filesystem.
    here is my code..
    private String populateImage() throws Exception {
                        if (currentNode != null && currentNode.isNode()) {
                                       Node ImageNode = JcrResourceUtil.createPath(currentNode, "image",
                                                                          null, "nt:unstructured", true);
                                       imageUrl = ImageNode.hasProperty("fileReference") ? ImageNode.getProperty("fileReference").getValue().getString() : "";
           imageUrl = imageUrl.trim();
            log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE IF IS: " + imageUrl);
                        } else {
                                            imageUrl = properties.get("fileReference", "");
                                            imageUrl = imageUrl.trim();
                                            log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE ELSE IS: " + imageUrl);
                        return imageUrl;
    So if I drag and drop..
    ImageNode.hasProperty("fileReference") is returning a valid path
    but if I upload an image  it is returning Null.
    So how to get the path? any suggestions around would be appreciated...

    When you say path you mean you want the path to print out in your HTML? Is that accurate? If so you generally need to constructe that path based on the path to the current component. So if you component is located at /content/mysite/en/about/mypage/jcr:content/parsys/image then the path to the image would generally be something like /content/mysite/en/about/mypage/jcr:content/parsys/image.img.jpg/1283829292873.jpg. The .img. selector triggers the servlet associated with the foundation parbase - /libs/foundation/components/parbase/img.GET.java. The reason you reference it this way is that there is no filesystem path to the image - it is stored in the repository not on the file system, and it requires a servlet or script to ge the binary from the repository and steam it.
    Normally the way you'd construct this is to use the out of the box Image class - so look at /libs/foundation/components/image/image.jsp. Now this example assumes that your component where you loaded the image extends /libs/foundation/components/parbase. If it doesn't then you either have to change your sling:superResourceType to /libs/foundation/components/parbase or some other component that does exten /libs/foundation/components/parbase.

  • How to get the path of the image stored in sap??

    Hi All
    The problem is
    While making an entry in standard there is a field called documents through which we attach our images in sap.
    How to get the path of the image stored with the corresponding order so that the image can be displayed while we are creating a report.
    I know how to upload the image while creating a report using docking control.
    I am not able to get the path of the image stored...
    Please Help
    Thanks in advance..
    Pooja

    I am not aware of exactly which tables are used for storing the attached doc. details, but we have worked in the similar requiremnent.
    What you can do is .... before uploading the image to any order, try swich on the SQL trace ST05 and after upload switch off.
    The log will display what are the tables involved while storing the image. And you can easily find out the image location.

  • How to get the full image directory when i upload the image to web page???

    hai, how to get the full image directory when i upload the image to web page???
    here is the example:
    <form action="uploadfile.jsp" method="post">
    image<input type="file" name="image" />
    <input type="submit" value="submit"/>
    <%
    String s=request.getParameter("image");
    %>
    <%=s%>
    </form>
    i upload the image from C:\image\center.gif. i use request.getParameter just can get the image name like "center.gif". Can anybody help me how to get the full path name. Thanks a lot..

    There is no need to get the path. It is also fairly pointless as the server cannot access the client's local file system.
    Carefully read this article how you can upload files the right way: http://balusc.blogspot.com/2007/11/multipartfilter.html

  • Some of thy images are appearing pixelated.  any idea on how to get the issue fixed

    some of my images in Aperture/iPhoto are appearing pixelated.  any idea on how to get the issue fixed

    Where can I find a copy of that? Like if I were to completely delete everything on my ipod, what would I do to go about restoring my songs?
    Also I have a theory that one of the videos on my ipod is causing all the other stuff. However, I can't delete videos off my ipod (see https://discussions.apple.com/message/20313736?ac_cid=tw123456#20313736). Is there any way i can get the music from the backup but not the videos?

  • HT1454 HELP! ITook loads of photos on my ipod touch, and when i went to look at them they were just black images , and then out of 50 bout 7 of them came out?anyone know how to get the black pictures turn out ?

    HELP! ITook loads of photos on my ipod touch, and when i went to look at them they were just black images , and then out of 50 bout 7 of them came out?anyone know how to get the black pictures turn out ?

    Try the following:
    - A reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup

  • 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
                   

  • [CS2]How to get the Image Width & Height using JS (ILLUSTRATOR CS2)

    Hi,
    How to get the Image width & height of an Image using javascript .Im using Illustrator CS2.
    Any sample code
    Regards
    MyRiaz

    you can reference the dimensions of a loading image (or swf)
    by referencing the target movieclip's dimensions AFTER loading is
    complete. ie, use preloader code or the onLoadInit() method of a
    moviecliploader listener.

  • How to get the parent of a component in fx?

    Here is an example:
    Index.fx:
    Stage {
        title: "Online book library";
        width: 1024
        height: 768
        scene:Scene {
        fill: Color.WHITE
        content: [
           banner ,
           login = Login{translateX:715 translateY:135}
    };Login.fx:
    var logOn : Button = Button {
            translateX:25 translateY: 170
            text: "Log On"
            font: Font {size:11 name: "Verdana Bold"}
            action: function() {
                showHello();
    function showHello(){
       // add a label in index.fx whose text is "welcome!";
        }I want to show something on the index.fx but I don't know how to get the parent from the child component?
    In Flex, we use parent or parentApplication, Is there a similar function in JavaFX?

    Reusing the same Tile example, I had no problems, I suppose I was doing wrong the first time:
    def IMAGES_WIDTH = 100;
    def IMAGES_HEIGHT = 100;
    var COLUMN_NB = 3;
    var ROW_NB = 3;
    var scene: Scene;
    var previews: Container;
    Stage
      title: "Test of Tile layout"
      scene: scene = Scene
        width: 500
        height: 500
        fill: Color.LAVENDER
        content:
          previews = Tile
            hgap: 10
            vgap: 10
            layoutX: bind (scene.width - previews.width) / 2
            layoutY: bind (scene.height - previews.height) / 2
            columns: COLUMN_NB
            content: for (i in [ 1 .. COLUMN_NB * ROW_NB ])
              ImageView
                id: "IV{i}"
                image: Image
                  url: "{__DIR__}clock.gif"
                  width: IMAGES_WIDTH
                  preserveRatio: true
                onMousePressed: Hide
    function Hide(evt: MouseEvent): Void
      println("{evt.node} ({evt.node.id}) - {evt.node.parent}");
      var nm: Node = evt.node.parent.lookup("IV5"); // Middle node
      nm.visible = false;
      var ntl: Node = evt.node.parent.lookup("IV1"); //Top left node
      (ntl as ImageView).viewport = Rectangle2D { height: IMAGES_WIDTH/2, width: IMAGES_WIDTH/2 };
      (evt.node.parent as Tile).hgap = 20; // Strange effect, but works
    }

Maybe you are looking for

  • E72 - How to Remove Home Screen Links

    Hello, I have a Nokia E72 and I have a customization problem. I have a gmail account installed in the phone and there is a homescreen link for it, just under the applications bar at the top. The thing I want to delete this link from my home screen bu

  • Movie rental refund

    I just purchased my first ever movie rental on iTunes and am MASSIVELY disappointed. My wife had never seen Back To The Future (I know! Where has she been!) so I paid the £3.49 and rented it for the night so we could watch it on our 42" plasma as we

  • How to find out what modules are used

    In /etc/rc.conf there are a lot of modules that are loaded that don't need to be, like modules related to OSS. Is there some command that'll show me what modules are being used at the moment and/or what they do?

  • X240 wifi issues

    I have often noticed that this laptop (win8) faces issues trying to connect with wifi when other cheaper devices (older laptops, phones) have no such difficulty. Generally this happens in cafes so the issue is bearable but of late I have started faci

  • Time machine error - backup fails due to sparsebundle already in use

    Since upgrading, Time machine reports backup error: TIme Machine Error The backup disk image ...sparsebundle is already in use. Any thoughts?