Image size and mime type.. non-java guy needs help

Image size, mime type.. non-java guy needs help
Im not at all familiar with java so this is really weird for me to work out. I?ve been doing it all day (and half of yesterday).
Im trying to write a custom clodFusion tag in java that gets the width, height, size and MIME types of a given file. I?ve been trying to get it to work on the command line first. I can get the width and height but cant get the size and the MIME type.
Here is what I got
/*import com.allaire.cfx.*;*/
import java.awt.image.renderable.*;
import javax.media.jai.*;
import com.sun.media.jai.codec.*;
import java.io.*;
import java.util.*;
public class ImageInfo {
private RenderedOp image = null;
private RenderedOp result = null;
private int height = 0;
private int width = 0;
private String type = "";
private String size = "";
public void loadf(String file) throws IOException
file = "80by80.jpg";
FileSeekableStream fss = new FileSeekableStream(file);
image = JAI.create("stream", fss);
height = image.getHeight();
width = image.getWidth();
System.out.println(height + "\n");
System.out.println(width);
System.out.println(type);
public static void main(String[] args) throws IOException {
ImageInfo test = new ImageInfo();
test.loadf(args[0]);
can anyone please help me out to modify the above so I can also print the mime type and the file size to screen.
thanks for any help

any suggestions?

Similar Messages

  • Image Size and File Type

    For image files we should be able to see the size of the image in inches in the details section.
    Also for any file, we should be able to quickly see the exact file type (Illustrator CS document or Illustrator CS2 document), not just "Illustrator document" which is absolutely useless.

    Stan,
    You can see the file type by hovering over the file in Library view and it will show the file name followed by the extension like jpg, nef or tiff.
    Alternatively in library mode go to grid view it will pixel size of the files as well as the name of the file withthe format.
    If you are not able to see that go to View>View Option.
    Check the option show header with label
    Hope thatt helps.
    Mandhir

  • Image size and type

    what Icon / Image size and type we should use of our own menu ?
    Giuseppe

    Hi Giuseppe,
    I'm not sure what restrictions there are on image type but I always use a 24bit Bitmap image with width 18px and height 14px. For transparency, set the background colour to RGB 192-220-192 and SBO will automatically make this area transparent, regardless of the colour scheme the user has on the client.
    Kind Regards,
    Owen

  • Image Sizes and Resolution standards?

    are there any standards for image sizes and resolution for mobile games specifically: backgrounds and backdrops?
    i will be porting my game for various cell phones and i'd like to resize images to fit perfect on all cell phone screens, so what would be the best way to do this and what should my image attributes (height, width) be?
    i've tried researching on google to see if there were any standards and couldn't seem to find any. if these standards are non-existent what image sizes have you used that you found worked best on various mobile phones?
    thanks
    Edited by: sassy on Jun 2, 2008 1:49 PM

    Google's right, there are no real standards for screen sizes. Some are more common than others, but there are dozens of common screen sizes.
    The most common are...
    176x208 (same as 176x220, but with no status bar)
    240x320
    176x220
    [Getjar resolution stats|http://www.mobref.com/statistics/world/gDispResolution]
    Unfortunately, many phones are slightly more or slightly less than those. If you cover those, you're fairly well off though. If you can make your game resolution independent, that's your best option, though with intricate overlays it may be nearly impossible to do.

  • Trying to embed a video file in HTML5: ERROR=No video with supported format and MIME type found?

    Hello all!
    I am desparate for a solution. I am testing my site on Firefox and Explorer and still no sign of a functional video yet.
    Firefox: I get the error: No video with supported format and MIME type found.
    Explorer: I just get a distorted layout.
    Here is the code I am working on:
    <table id="Table_01" width="480" height="801" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="6">
                <img src="images/Video_01.jpg" width="480" height="114" alt=""></td>
        </tr>
        <tr>
            <td rowspan="3">
                <img src="images/Video_02.jpg" width="52" height="486" alt=""></td>
            <td colspan="4">
               <video controls width="376" height="221">
                 <source src="C:\Users\aalmeida\Videos\AEMC PEL 103 6 Channel, Power & Energy Logger - with Display (Part 1).mp4" type="Video/Mp4"/>
                 <source src="C:\Users\aalmeida\Videos\AEMC PEL 103 6 Channel, Power & Energy Logger - with Display (Part 1).webm" type="Video/WebM"/>
                 <source src="C:\Users\aalmeida\Videos\AEMC PEL 103 6 Channel, Power & Energy Logger - with Display (Part 1).oggtheora.ogv" type="Video/Ogg"/>
                 </video>
    Please tell me that there is something missing in the code. I have spent a lot of time uninstalling-updating Firefox plugins, added MIME types in the Internet Information Manager (I'm on Windows 7)
    and  seriuously hit a dead end with this!
    Any advice would be muchly appreciated!!!
    Thanks
    ~LA

    As Jon said, you must declare the page as HTML5.
    And your server may not be set up to deliver video as a binary file if it is an .OGG file. I have not seen this problem with .MP4 or .M4V in the past, but every server is a little different.
    To add a MIME type, you need to change your .htaccess file on an Apache server thusly:
    AddType audio/ogg .oga
    AddType video/ogg .ogv
    AddType application/ogg .ogg
    AddHandler application-ogg .ogg .ogv .oga
    Additionally, MIME types can usually be changed on a server's Control Panel. One can also ask one's hosting provider to do this as well.
    Firefox makes it necessary to use OGG files. Webkit-based browsers will deal with .M4V or .MP4 and I understand Internet Exploder will work with the latter two as well.

  • How To Get FileType and MIME Type from a File

    Hi,
    I am using following ways to get FileType and MIME Type.
    I am able to get file type, but I am getting MIME Type as */*
    Can any one please let me know how to get MIME Type, but it should not be time consuming process.
    For File Type I am using following Code:
    private String getFileData(InputStream inStream) {
    fileName = C:\temp\temp.tiff
    String filePath = Util.createTempFile(fileName);
    RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
    while (inStream.available() > 0) {
         byte[] buf = new byte[inStream.available()];
         inStream.read(buf);
         raf.write(buf);
    inStream.close();
    raf.close();
    File file = new File(filePath);
    JFileChooser chooser = new JFileChooser();
    String fileType = chooser.getTypeDescription(file);
    file.delete();
    //MIME Type I am getting from
    DataHandler data = new DataHandler(new DocumentSource(inStream));
    data.getContentType();
    data.getContentType() is not working well in all cases.
    Can any one help me on this.
    Thanks in advance,
    Ram.
    Edited by: javausers07 on Apr 15, 2009 4:25 PM

    javausers07 wrote:
    Hi,
    I am using following ways to get FileType and MIME Type.
    I am able to get file type, but I am getting MIME Type as */*
    Can any one please let me know how to get MIME Type, but it should not be time consuming process.
    For File Type I am using following Code:
    private String getFileData(InputStream inStream) {
    fileName = C:\temp\temp.tiff
    String filePath = Util.createTempFile(fileName);
    RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
    while (inStream.available() > 0) {
         byte[] buf = new byte[inStream.available()];
         inStream.read(buf);
         raf.write(buf);
    inStream.close();
    raf.close();
    File file = new File(filePath);Why do you do all above?
    JFileChooser chooser = new JFileChooser();
    String fileType = chooser.getTypeDescription(file);
    file.delete();
    //MIME Type I am getting from
    DataHandler data = new DataHandler(new DocumentSource(inStream));
    data.getContentType();
    data.getContentType() is not working well in all cases.That's because there's no way to get MIME type of all files on all filesystems.
    Kaj

  • The ipad won't sync some photos, saying the file can't be read by the ipad, however it will sync some photos taken at the same time which are the same size and file type.  Why does it reject some and accept others?

    The ipad won't sync some photos, saying the file can't be read by the ipad, however it will sync some photos taken at the same time which are the same size and file type.  Why does it reject some and accept others?

    Hi there. I'm having the same problem: my iPad won't import some photos from a folder, saying that they can't be read. They are all JPEGS and some photos taken at the same time have synched fine, but out of a folder with 200 photos, it only lets me synch 37. I'm synching albums created via Photoshop Elements 6, which has worked fine until now.
    I've tried deleting all photos and re-synching, and have also deleted the iPod Photo Cache, but it hasn't made a difference.
    The iPad auto-updated to the latest version of iTunes, so maybe that's what's causing it?
    Any advice gratefully received!

  • Image size and dimensions in Safari

    Is there a fast method of viewing image size and dimentions in Safari? I can open image in new tab and see its width and height in tab/window name. I can save image to the Desktop and see file size but it's not convenient. Is there some another way without opening an saving image somewhere like Control+click -> Properties?
    iMac G4   Mac OS X (10.4.3)  

    Pat,
    You don't need to set the image size as such. The image prints on the page according to two sets of criteria:
    1. Whether you set dpi to custom or a specific value, and
    2. The page margins you set either as a printing once-off, or as a new printing pre-set.
    For example, I print "arty" photos in a portrait format on A4 matte paper. Left and right margins are around 3cm, top margin is around 3cm, bottom margin is around 5 cm (all numbers are from memory...). I have a title just below the image.
    I created this particular page setup for a certain photo and liked it so much I saved it as another print preset. Any photo I print using that preset fits within the margins defined. The very next print might be the same photo, but this time printing A3+ on Ilford Galerie Smooth Pearl. Choose the photo, select the relevant print pre-set, print. Re-sizing is irrelevant - the print in both cases is coming from the processed raw at maximum resolution.
    Regards,
    Calx

  • How do you change the image size and resolution in photoshop everytime I change the width the height changes my measurements will not stay

    Can someone assist me with changing image size and resolution.  each time I change the width the height changes and vice/versa?

    There's a chain link between width and height. The point is to keep the aspect ratio the same, otherwise your picture would get stretched.
    You click on the chain-link to shut that off and you can adjust width and height separately.
    Also could you give us your version of Photoshop, what OS you are running it on (Windows 7 for example) and what exactly you want to do with your document?
    Resolution is the print term for how many pixels will be printed on an inch of paper. It doesn't apply if your image is intended for screen viewing.
    Gene

  • Reduce image size and print it out?

    I scanned an image (coloring on a postcard). This size is too big to fit into a 'album' picture in MS Picture It! All I want to do is REDUCE the image and save it so that it will fit into the computer photo album I'm creating.
    I've tried Image/Resize/Image Size and changed the sizing, but it still comes out the exact same size as the original. What am I doing wrong?

    > I want to REDUCE the image, not enlarge it.
    I understood that - what makes you think I didn't?
    > It's 948x645 pixels. I just want the image about an inch (respectively) smaller
    You can't think in terms of inches for screen images. You have to work in pixels and the actual size will depend upon the screen resolution on the machine being used to view the image.
    I'd reduce the pixel size by about 80 to get the effect that you want. Use Image/Resize/Image Size and make sure that you have "Resample" checked.

  • Access image size and color profile

    Hi all,
    Is it possible to access image size and color profile ? If not, will it be possible in CS6 ?
    Thanks.

    Load the external XMP library and get it from that?

  • Recommended image size and dimensions for images displayed on iPad retina?

    What are the recommended dpi image size and dimensions for images designed in DPS app as displayed on an iPad retina?

    Take a look at the following link:
    http://blogs.adobe.com/indesigndocs/2012/03/guidelines-for-creating-folios-for-ipad-3.html

  • In SAP 4.6c In classical reports output how to change Font size and Font type

    Dear Experts,
    In SAP 4.6c, in classical and interactive reports  output how to change font size and font type.
    Regards,
    Zaker.

    These are HTML formatting questions. Nothing to do with the Oracle SQL and PL/SQL languages.
    With old-style HTML, the font size and family are set using the font tag.
    With modern style HTML, that is done using cascading style sheets (CSS).
    Your favourite search engine will turn up tons of information on both.

  • Checking Image Size and Dimensions

    How do I check the size of an image like a Signature or another image without having to save it and then checking it? Is there a way to check it in Safari?

    What? I don't see "Inspect Element" anywhere.
    Are there any plugins (perhaps at pimpmysafari.com) where we can add functions such as "Properties" for viewing image size and dimensions, as well as "View Image" to view the image by itself? I'm trying to convert from Firefox, but these are a couple of the things getting in the way.

  • No video with supported formate and mime type found

    I am able to view videos on all but 1 website: http://www.start-american-sign-language.com/free-sign-language-asl1.html
    When I view that page, the video box only shows the x with "no video with supported formate and mime type found" being displayed.
    I have updated to the most recent palemoon (25.3.0) and have the following plugins installed
    DRM 9.0.0.4503
    Shockwave flash 16.0.0.305
    Silverlight 5.1.30514.0
    VLC Web Plugin 2.2.0.0
    Windows media Player Dynamic Link LIbrary 3.0.2.629
    I have cleared my cache and cookies, and am unable to view the video in question. If I go to https://www.youtube.com/html5, it indicates that I have an operable Webelement player and Web VP8, and all others are exclamation points.
    Does anyone know why I can't watch the (mp4) video(s) in question? I have turned up no viable solutions using the forums or google.
    Thanks!

    This happens when there is no support in your Windows XP version to play any of the media file formats that the website offers with the HTML5 media player (i.e. not a Flash player is used, but a video tag).
    That are MP4 files with type="video/mp4"
    *VLC shows: Codec: H264 - MPEG-4 AVC (part 10) (avc1)
    You might be out of luck on Windows XP and your only option would be to use an external media player and paste the links in its location field.

Maybe you are looking for

  • S-Video Input

    Hey guys! I would like to replace my current Intel Pentium 4 PC and cannot decide if I should get an iMac or build a PC. Anyways, I am not going to ask that here since I know what the outcome is going to be. What I would like to know is if the iMac s

  • Delete 70,000,000 records from a Table .... Please help

    I am new to Oracle database. please help on Oracle9i Enterprise Edition Release 9.2.0.1.0 We have one master table with 15,243,350 records and a child table 71,447,235 records in our Oracle database and the slow performance has been hitted our daily

  • Problem with my photostream

    My photostream on iphoto will not cooperate with my iPhone. iPhoto import pictures that I've taken with the camera and load it into photostream instead of my mobile pictures. How can I stop it?

  • Annoying Ads Wont Go Away

    I keep getting these "visual match" ads, pop ups, and redirect tabs.  Its never happen before until a couple of days ago.  I use chrome and my macbook is up to date.  Is there anyway I can get rid of these without having to buy anything?

  • Sharing library between computer over a network

    Hi, I'm trying to share 2 different ip libraries on 2 different computers. But one has ip4 and the other one has ip6. Do both iPhoto have to be of the same level (ip4 vs ip6) to be able to share? Reason is that I see the icon of the other library on