Find ths format of an image

Hi,
I'm actually triing to create an Java (JSP/Servlet) web-app witch di that :
Read a temp file (per example Lds2456.tmp) witch is an image, but the suffix do not say the format of the image (it's ".tmp", NOT ".jgp", ".gif",....).
I would use javax.image (not JAI), to find ths format of the ".tmp" file. Too, after, change is name in the right suffix name (switch the format, like ".png", ".tif", ".jpg",...) too use it in a JSP page (using HTML tag <img src="myImageURL">).
Can some one help me ?

Nobody see !?

Similar Messages

  • Find format of an image

    Hi,
    I'm looking for finding the format of an image file (or stream) : tiff, jpg, gif, png, bmp, ...
    I don't want to use the extention name (.jpg, .tif, ...), but the contain of the file himself.
    how can I do it with JAI (without JDK 1.4) or an other java librairy please ?

    See http://gd.tuwien.ac.at/opsys/linux/java/JAI/1.0.2/i386/?file=jai1_0_2-beta-sample-linux.tar.bz2&type=listing

  • How to find format of an image when its byte[] content alone is available?

    Hi,
    I'm working on code that gets an image content as input in byte[] format. With no other further details provided, how to identify the format of the image contained in the byte array? Specifically, I would like to know if the image contained in it is a PNG, JPG, BMP, etc.
    Image or ImageIO API does not seem to provide a means to do this. Is there a way how this can be achieved?
    Thanks in advance.

    The ImageIO class does provide a way to do what you want... it just takes a couple of steps. Take a look at the determineInputFormat() method below:
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.ImageInputStream;
    public class ImageFormatTest {
       private static final String IMAGE_PATH = "... PATH TO IMAGE HERE ...";
       public static void main( String[] args ) {
          try {
             final byte[] imageBytes = readImageBytes( IMAGE_PATH );
             final String imageFormat = determineImageFormat( imageBytes );
             System.out.println( "Image format is " + imageFormat );
          } catch (Throwable ex) {
             ex.printStackTrace();
       private static byte[] readImageBytes( String imagePath ) throws IOException {
          final File imageFile = new File( imagePath );
          final byte[] buf = new byte[ (int) imageFile.length() ];
          final FileInputStream fStream = new FileInputStream( imageFile );
          fStream.read( buf );
          fStream.close();
          return buf;
       private static String determineImageFormat( byte[] imageBytes ) throws IOException {
          final ByteArrayInputStream bStream = new ByteArrayInputStream( imageBytes );
          final ImageInputStream imgStream = ImageIO.createImageInputStream( bStream );
          final Iterator<ImageReader> iter = ImageIO.getImageReaders( imgStream );
          final ImageReader imgReader = iter.next();
          return imgReader.getFormatName();
    }

  • Supported Image formats in af:image?

    Could anyone pls. list which Image formats - the af:image component supports?
    I can't find it listed anywhere,
    Thanx in advance,
    Henrik

    Unfortunately - using jpg - is not an option - due to external requirements.
    Are there another ADF component/construction I can use - to getting ti tiff shown?
    Rgds, Henrik

  • How to find, select and delete duplicate images fro LR catalog?

    I'm on a MacPro, Leopard, LR v1.4.1
    How do you FIND duplicate files and remove them from the catalog?
    I had 12 images outside of a subfolder on a job. When I did a "synchronize folder" action it added those same 12 files to the catalog. I then physically moved the files into the correct folder - replacing the ones of the same name inside. Now I have 2 images of the same name in the catalog. I know I an choose them one at a time & Remove, but I can see this happening on a larger scale where I would want to Find All Dupes, then remove them.
    Same thing would happen if you imported from a folder or card that hadn't be formatted & forgot to check the "don't import suspected dupes" box.
    thanks!

    "I then physically moved the files into the correct folder"
    Precisely how? You didn't use Explorer/Finder, did you? Once images are in Lightroom, use Lightroom for moving files between folders. The best way to remove duplicates is to avoid having them in the first place.
    To get rid of existing ones, one way is to select those folders and save the XMP (Metadata > Save....) and then remove those folders from LR. Then import them again. Alternatively sort them by capture time and go through eyeballing them - use the reject flag to identify duplicates and then the delete rejects command.
    John

  • XML parser not able to find encoding format of xml file with jre1.4.2

    Hi
    I am using jre1.4.2_05 and Weblogic 8.1 version and i have a problem with finding encoding format of xml file.
    I need to parse a xml file and need to find which encoding format that xml is based on that i need to change logic.
    Need to know after parsing each xml file what encoding format the xml is? Here the problem is we are using jre1.4.2_05 by default DOM \ SAX parser is not supported and i looked at few third party parser which are also don't have facility.
    But in latest jre 1.5 or jdk1.5 has this feature. Its difficult to the project to upgrade to jre1.5 or more.
    Please let me know if you have any idea about the issue.

    I had a quick look around and I think you might be able to find them in the support portal...
    SAP Support Portal > Software Downloads > SAP Software Download Centre > Support Packages and Patches > Archive for Support Packages and Patches > Archive - Browse our Download Catalog > SAP Connectors.
    Let me know if you find them.
    Regards,
    Stephen.

  • JS CS3 How can I find -and delete- anchored empty images frames

    I have a script that works fine with text,
    I need the same function, but find and remove anchored empty image frames
    thx
    var myDoc = app.activeDocument
    for(var myCounter = myDoc.textFrames.length-1; myCounter>=0; myCounter--)
    var myFrames = myDoc.textFrames[myCounter]
    if (myDoc.textFrames[myCounter].contents == ""){
    myDoc.textFrames[myCounter].remove()

    I'd do it this way:
    1. Grab the document's allPageItems.
    2. Iterate over it, ignoring text frames.
    3. Check to see: (a) if the parent is a character and (b) if the graphics collection of the page item is empty. If so, delete it.
    Dave

  • I am using a MacBook Pro.  I simply cannot find a way to attach images adjusted in Lightroom as attachments and/or without massive degradation in quality.  I follow the LR attach email process as specified by LR, the photos appear in the email seemingly e

    I am using a MacBook Pro.  I simply cannot find a way to attach images adjusted in Lightroom as attachments and/or without massive degradation in quality.  I follow the LR attach email process as specified by LR, the photos appear in the email seemingly embedded and the recipients of the email cannot save the attachment.

    You are welcome.  Just finished a chat session with an Apple support rep and confirmed the matte option no longer available.  Seems lots has changed since I bought my 17” 19 months back:).  They did say that there were after market screen films available from places like amazon
    Have never used anything like that though.  My wife has a 2008 MBP 15” with gloss and I can say it is a nice screen finish, you just have to be careful of lighting from behind you.  All my iMacs were glossy and I did learn to compensate for the added brilliance the screen brought to the photos.  The new soft proofing feature of LR5 seems to better estimate the level of brightness of the printed work, compared to past versions of the s/ware.
    In any case, in my opinion you really can’t go wrong with the apple product.  I bought my first iMac in mid 1999 and have never looked back.  I donated that machine to a pre-school in 2008, it was running OSX version 2 or 3 I think.  I did run Photoshop 7.0 on an IBM laptop for a time (windows XP).  I think I had one of the very first versions of Adobe Camera Raw on that machine.  I digress, sorry.
    The chat representative did confirm that the 17” is out of production and I’m guessing Apple found the market for the big laptop just wasn’t there.  They did mention that 17” MBP’s show up as “certified refurbished” units from time to time.  Suggest you might explore that option with a local Apple store in the UK, assuming  Apple has store front operations off this continent of course.
    Please feel free to contact me with further questions if you wish.
    Take care, Gordy

  • Need help with adding formatted text and images to Crystal Report?

    Here's my scenario:
    I have a customer statement that's generated as a crystal report and that has a placeholder for advertisement. The advertisement is mixture of formatted text and images. Until now we only had one advertisement that was always used on the report. The new requirement is that we would have a pool of hundreds of advertisements and would need to display one specific advertisement on the customer statement based on various marketing criteria. They key is that the advertisement content will be determined programmatically and cannot be hardcoded into the report. I'm using Crystal2008 with .net SDK.
    Here are the solutions I thought of, but I'm still rather lost and would appreciate your help/opinion.
    1) Pass HTML or RTF to the report
    Not really sure if this is possible and how to get it done. Also how would I pass in images? Would display formatting be reliable when exporting to PDF?
    2) Create each add as a subreport and append it programatically
    I actually have this working, but I only know how to append a new section to the end of the report and then load the subreport to the section. I have no other controll of the placement. Is there a way to dynamically load a subreport to a predefined section in the main report? How about adding a dummy subreport in the main report as a placeholder and then replacing it with a different subreport? How could I do this?
    3) Pass an Image to the report
    I would create each advertisement as an image and then would somehow add the image to the report. How would I load the image and control the placement? Could I somehow define a placeholder for the image in the main report-maybe a dummy image to be replaced?
    Thank you.

    Hello Pavel,
    I would got the third way.
    You can use dynamic images in your report.
    Just by changing the URL to the image the image can be changed.
    Please see the [Crystal Manual|http://help.sap.com/businessobject/product_guides/cr2008/en/xir3_cr_usergde_en.pdf] and search for images.
    or directly here
    [Setting a Dynamic Graphic Location Path on an Image Object|https://boc.sdn.sap.com/node/506]
    [Dynamic image and HTTP://|https://boc.sdn.sap.com/node/3646]
    [codesample for .NET|https://boc.sdn.sap.com/node/6000]
    Please also use
    [Crystal Reports 2008 SDK Documentation and Sample Code|https://boc.sdn.sap.com/developer/library/CR2008SDK]
    [Crystal Reports 2008 .NET SDK Tutorial Samples|https://boc.sdn.sap.com/node/6203]
    Hope this helps
    Falk

  • Deleting photos than don't display in finder - just an icon not image

    Hi
    I have plugged in an old hard drive today I have not used for a while to get some old photos from.  There are thousands on the drive, but I notice in finder than many of them display as .jpg icons in finder and not with an image of the photo.  To no surprise, they don't open either.  I think it might have been a problem with the drive they came from, but do have copies so not concerned.
    Is there any quick way of deleting these thousands of non-working images from my hard drive to clear out the debris so I am only left with working photos.
    Thanks in advance.
    Matt

    Rob Cole wrote:
    I whole-heartedly agree that although the big print giveth, sometimes the small print taketh away, DNG-wise.
    I certainly would not convert my raw files to dng then throw away the originals. If Adobe provided a "revert from DNG" function, I'd recommend people give DNG a try (and not toss the originals), but as it stands:
    (Adobe-converted) DNGs: great for limited, known, (usually Adobe-only) environments, but not for wholesale conversion of raws, not yet anyway (unless you don't mind locking yourself into an Adobe-only (or Adobe-mostly) software environment, in order to support "the cause").
    PS - In my opinion, you may be going a little too far with this one:
    BarryLevine wrote:
    This is fraud.
    but still - point taken.
    Rob
    "Adobe-only environments". Nope, sorry; that doesn't exist. Adobe makes software that runs on OSX and Windows.
    I will bet $50 that buried in the OSX Lightroom code is reliance upon Quicktime. Adobe could rectify this. It's a lack of will, not technology.
    I can be angry and upset but I will still use Lightroom because, in spite of this setback, LR produces DNGs that are smaller than TIFF and lossless PNG and produces better photos easier than other apps (including Aperture).
    ...and yes, I still believe Adobe's marketing is either fraudulent or just doesn't understand the technology.

  • Find dpi & Align center of Image

    Hi All,
    I have new request but struggling in the below points:
    1. Find less than 300 dpi image in the active document
    2. Create text frame and fix center of the image vertically and horizotally.
    Hope I completed the script by 90%
    Completed Script:
    var myGraphics = app.activeDocument.allGraphics;
    var targetResolution = 300;
    for (var i = 0; i < myGraphics.length; i++) {
        try
        if (myGraphics[i].effectivePpi[0] < 300) {
            var myPPI = myGraphics[i].effectivePpi[0] + " dpi"             //please ensure this line should be correct
            var myName = myGraphics[i].itemLink.name;
            var myPage = myGraphics[i].parentPage;
            var myCaption = myPage.textFrames.add();
            myCaption.textFramePreferences.verticalJustification = VerticalJustification.TOP_ALIGN;
            myCaption.contents = "FPO\r" + myName + "\r" + "Low Res " + myPPI;
            var bnds = myGraphics[i].parent.visibleBounds;
            myCaption.visibleBounds = [bnds[2] + 3, bnds[1], bnds[2] + 6, bnds[3]];
            myCaption.fit(FitOptions.FRAME_TO_CONTENT);
            try {
                var myPStyle = app.activeDocument.paragraphStyles.add({name: "Caption_lowres", justification: Justification.CENTER_ALIGN});
            } catch (myError) {
                  myCaption.parentStory.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("Caption_lowres");
            myPage.groups.add([myCaption, myGraphics[i].parent]);
    catch(myError)
    REQUIRED OUTPUT
    But Current Output using above script
    Thanks
    Beginner_X

    Hi Mr.Dave,
    Thank you for your response...
    I trying your code but I am not able to get the output.
    Could you help to get the output for me.
    var myGraphics = app.activeDocument.allGraphics;
    var targetResolution = 300;
    for (var i = 0; i < myGraphics.length; i++) {
        try
        if (myGraphics[i].effectivePpi[0] < 300) {
           var myPPI = myGraphics[i].effectivePpi[0] + " dpi"
            var myName = myGraphics[i].itemLink.name;
            var myPage = myGraphics[i].parentPage;
            var myCaption = myPage.textFrames.add();
            myCaption.textFramePreferences.verticalJustification = VerticalJustification.TOP_ALIGN;
            myCaption.contents = "FPO\r" + myName + "\r" + "Low Res " + myPPI;
            var bnds = myGraphics[i].parent.visibleBounds;
            myCaption.visibleBounds = [bnds[2] + 3, bnds[1], bnds[2] + 6, bnds[3]];
            var center = {x : (bnds[1] + bnds[3])/2, y : (bnds[0] + bnds[2])/2}
            var capCenter = {x : (capbnds[1] + capbnds[3])/2, y : (capbnds[0] + capbnds[2])/2}
            myCaption.move(undefined, [center.x - capCenter.x, center.y - capCenter.y]);
             myCaption.fit(FitOptions.FRAME_TO_CONTENT);
            try {
                var myPStyle = app.activeDocument.paragraphStyles.add({name: "Caption_lowres", justification: Justification.CENTER_ALIGN});
            } catch (myError) {
                  myCaption.parentStory.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("Caption_lowres");
            myPage.groups.add([myCaption, myGraphics[i].parent]);
    catch(myError)
    Help me to get output as per attached screenshot
    Thanks
    Beginner

  • Find multiple formats in one search?

    Is there any way I can find multiple formats in one search? I need to find all instances of a paragraph style that comes after another paragraph style.

    Sorry, no, the Find/Change function doesn't permit that.
    You could export to InDesign Tagged Text and manipulate that text file with an external tool...

  • What is the best format to import images into iBA? How should I compress my images before importing? What is the best file format? PNG? Jpeg?

    What is the best format to import images into iBA? How should I compress my images before importing? What is the best file format? PNG? Jpeg? I'm trying to figure out the best file format / compression for importing images into iBA. Also, does anyone know how iBA will compress the file? Are the assets attached (like a website) or flattened out? Does anyone know how iBA handles this? Many many thanks to anyone with insight into this.

    This question is largely answered by the following thread...
    https://discussions.apple.com/message/17805700#17805700

  • Need help finding the format bar in numbers

    I am new to using Numbers.  Am trying to create a new document, but unlike Excel, I can not find a format toolbar where I could make corrections to text.  What am I missing?  Can someone tell me how to add the format toolbar in Numbers.  Using latest iMac, system, and iWorks, thanks

    LexSchellings wrote:
    SGIII: the Dock is just an alias. Whatever you use to access the document, it is always the document itself: it stays one document. Every editing is in that same file.
    Hi LexShellings,
    I'm not sure that description is entirely true.  There is more than one copy of the document. The way I understand it, documents stored in iCloud are (obviously) on Apple's servers and also, on each Mac or iOS devices with that iCloud account, a separate copy is stored in a special local folder whose contents are synced automatically to Apple's servers.
    When you make a change on the Mac you are changing the copy stored in the local folder Library > Mobile Documents > com~Apple~Numbers.  Then daemons come along and sync that local copy with the document up in the cloud.
    Same with changes made on iOS devices.  A copy of the document is stored in a special local folder. The contents of that folder is synced up to Apple's servers.
    So if you want a document stored in iCloud to show up on the Dock, you can just drag it from Library > Mobile Documents > com~Apple~Numbers to the Dock, because, as you point out, an alias is automatically created whenever you drag something to the Dock.
    If you want the iCloud document to show up in your Documents folder, though, you need to first make an alias of the copy stored in Library > Mobile Documents > com~Apple~Numbers and drag that alias to Documents.
    My personal preference is still to open a document from within the application. Fewer things to go wrong and I that way I can also be sure I am opening it with the correct version of Numbers.
    SG

  • Find text and replace with image - Help needed

    Hi,<br /><br />We need to place the images as inline in the appropriate places.<br /><br />texttexttext<<test1.eps>>texttexttexttexttexttext<<test2.eps>>texttexttexttexttexttext< <test3.eps>>texttexttexttexttexttext<<test4.eps>>texttexttexttexttexttext<<test5.eps>>text texttext<br /><br />This code is helpful for placing a single image at a time, we are unable to place all the images in one shot, can anyone help me out.<br /><br />I am not a programmer.<br /><br />-----------<br />var myDoc = app.activeDocument; <br />app.findPreferences = app.changePreferences = null; <br />var math=document.search("test.eps"); <br />for (i=math.length-1; i >=0; i--)<br />{ myDir = Folder.selectDialog(); <br />AllGraphics = Folder(myDir).getFiles('test.eps') <br />for (i=0; i<math.length; i++) { app.select(anil1[i]); <br />     myDoc.place(AllGraphics[i],false); } }<br />-----------<br /><br />Note: I have taken this code from forum and we have made some changes on this.<br /><br />Kavya

    Jongware,<br /><br />I try running it but gives errors:<br /><br />Error Number: 55<br />Error String: Object does not support the property or method 'changePreferences'<br />Line: 24<br />Source: app.findPreferences = app.changePreferences = null;<br /><br />This is the code I used<br /><br />// Find text and replace with image for InDesign CS3 <br />// http://www.adobeforums.com/webx?128@@.3bbf275d.59b6f012<br />var heyItsAnArray = new Array ( <br /><br />   "it contains this line!", <br /><br />   "as well as this one", <br /><br />   "or even more!", <br /><br />   "test.eps" ); <br /><br />for (arrayCount=0; arrayCount<heyItsAnArray.length; arrayCount++) <br /><br />{ <br /><br />   replaceImg (heyItsAnArray[arrayCount]); <br /><br /> } <br /><br />function replaceImg (name) <br /><br />{ var myDoc = app.activeDocument;  <br />     app.findPreferences = app.changePreferences = null;  <br />     var math=document.search(name); <br />     for (i=math.length-1; i >=0; i--)  <br />     { myDir = Folder.selectDialog();  <br />          AllGraphics = Folder(myDir).getFiles(name)  <br />          for (i=0; i<math.length; i++) { app.select(anil1[i]); <br />               myDoc.place(AllGraphics[i],false); <br /><br />               } <br /><br />          } <br /><br />     }<br /><br />Michael

Maybe you are looking for