Save common formats of image

Hi experts,
i have developed this code in servlet to save user's uploaded image.
bis = new BufferedInputStream(item.getInputStream());
                        BufferedImage bImg = ImageIO.read(bis);
                        BufferedImage buffImg = new BufferedImage(bImg.getWidth(), bImg.getHeight(), bImg.getType());
                        Graphics2D g2d = buffImg.createGraphics();
                        g2d.drawImage(bImg, null, 0, 0);
                        g2d.dispose();
                        ImageIO.write(buffImg, "JPEG", new File(imgPath + title + "/" + item.getName()));
                        imgName += item.getName() + " ";it is working fine with .jpg formatted images but not allowing to upload .png.
and dispalying error "java.lang.illegalArgumentException: Unknown image type"
on this line:-
BufferedImage buffImg = new BufferedImage(bImg.getWidth(), bImg.getHeight(), bImg.getType()); please guide me what to do to make this code suitable with .png, .gif, .tif.
Thanks
Shams

Hi,
Make sure the drive  has the permissions you expect.
You should also make sure the Ignore Ownership items is checked.
Sometimes the issue is about the Read/Write permissions of the containing items  as well as an Ownership state to do so.
10:22 pm      Friday; March 28, 2014
​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
 G4/1GhzDual MDD (Leopard 10.5.8)
 MacBookPro 2Gb (Snow Leopard 10.6.8)
 Mac OS X (10.6.8),
 Couple of iPhones and an iPad

Similar Messages

  • Is there a way to format multiple images at once? Change colour mode or resolution?

    Is there a way to format multiple images at once? Change colour mode or resolution?

    It's very easy to make an action.
    Go to window > actions
    In the actions panel, simply click the 'create a new action' button, it starts recording as soon as you've created it (when you've given it a name).
    Now you can apply the changes you want to make to the images on the file you have opened.
    After you've done all you need to do. You click the 'stop' button. The action is now ready to use. And you can apply the changes you made on all the other files.
    Then you can continue how gener7 explained.
    I usually include a save and close command, so that the whole batch doesn't end up opened after running the script.
    But if you do that you have to create a new file, and save it to your computer before you start recording the action, otherwise the save command will be replaced by each file. And you'll end up with one edited file in the end. At least for as far as I know!

  • Media Encoder CS6 doesn't export any of the common formats like .MOV, .AVI, .AIFF .WAV, etc.

    When I queue exports from Premiere CS6,  Media Encoder totally ignores any custom export settings, and chooses some completely different system defined default settings, which I did not choose in Premiere. In previous versions Premiere would always pass the encoding settings to the Media Encoder.
    Update: When I tried to import the custom settings into Adobe Media Encoder, I got an error message: "Preset could not be imported. No exporter found for this preset." Then I've realized, that AEM doesn't even have a QuickTime export format!!! Actually it offers only 4 export formats: H.264 (MP4), FLV, F4V, and MP3. Then, when I queue an export with Premiere with one of those 4 formats, then AEM would accept it. Anything else - it just wouldn't work!!! So wait - am I missing something, or I literally cannot queue any other common format exports with AEM??? I need to work with MOV, AVI, AIFF, WAV etc. files, which all aren't accepted by the Media Encoder... Or am I missing something???
    This is ridiculous. I am becoming quite fed up with Premiere CS6 bundle - in 20 minutes I have found already 4 diferent features, that worked in previous versions, and work no more in CS6
    I don't know how it worked in CS5.5 - anybody?

    I have found the solution in another thread!!! It's here: http://forums.adobe.com/message/4503096
    1. Open this file:
    On MAC: /Applications/Adobe Media Encoder CS6/Adobe Media Encoder CS6.app/Contents/Resources/txt/AddExporterList.txt
    On PC: C:\Program Files\Adobe\Adobe Media Encoder CS6\txt\AddExporterList.txt
    2. Back it up to some other location.
    3. Then delete everything from it and paste this:
    # MediaCore Plugins
    # AME Plugins
    AudioWriter
    WinMediaWriter
    # AME Plugin Formats
    MPEG4
    H.264 Blu-ray
    4. Save it, and relaunch Media Encoder - voila! It worked for me and many others.

  • How to make Photoshop save Aperture imported JPEG images as JPEGs

    Recently, I upgraded from Photoshop CS 5 to CS 5.1.
    My point and shoot cameras record in JPEG format. Often, I'll import those photos into Aperture and then tweak them in Photoshop using the Edit in External Editor command. My preferences for the external editor in Aperture were set to 8-bit, Photoshop
    With Photoshop CS 5, I would edit the photo and choose Save and the edited photo would be saved back to Aperture as a new version, in a JPEG format.
    Now, using Photoshop CS 5.1, when the imported image from Aperture is converted into a PSD file and when I save back to Aperture, I end up with a PSD file.
    How can I revert to how it was before? JPEG image in Aperture, opened in external editor Photoshop as a JPEG, edited in Photoshop, then saved back to Aperture as a new version JPEG?
    (Though this question is approached in this forum, a solution to my question is never found as each dicussion ends up going off-topic from the original question)

    clapperincus wrote:
    Any further ideas from anyone who's experienced trying to open a JPEG from Aperture in Photoshop as a JPEG?
    Like I said before, you cannot open a jpeg as a jpeg, the file must be decompressed to open in PS or in Aperture, and that has always been the case.
    I do not know how it used to work, but I tested and you are correct that with PS 12.1 and with Aperture 3.2.2 a JPEG sent to open in external editor (PS) is opened into your choice of lossless format and then goes back to Aperture in the lossless format you chose.
    IMO this is the way it should be, because every save into JPEG loses image data, so such saves should be limited to the final export, in this case when the image actually leaves Aperture. If the file was compressed as a JPEG  when leaving PS, decompressed and edited in Aperture, then compressed again to export as JPEG from Aperture, unnecessary additional image data loss would occur.
    It is always better to save the application of lossy compression until the very last step in a workflow because other usages (printing, for instance) may occur before applying the lossy compression.
    -Allen

  • How to save a scan in Image Capture?

    How do I save my scan in image capture?
    What option to I go to save it as a JPEG or PNG to my computer?

    There's no Save command because Image Capture automatically saves scans when you click the Scan button.
    To find the format options, you have to click Show Details at the bottom. This will reveal the save location and format options, including an Overview button so you can test your crop etc. settings before you do the final scan.
    Baby Boomer (USofA) wrote:
    Image Capture>Help>Image Capture Help.
    This suggestion is not very helpful because this information is very difficult to find in the Help. Image Capture doesn't have a "Save" or "Export" command like most apps do, so anyone trying to find this info in Image Capture Help will be frustrated until they eventually dig down and discover the section "Scan images with a flatbed scanner using detailed options." In fact, if someone searches for the term "save" it doesn't even turn up any results, and "JPEG" or "PNG" only turns up results for the digital camera import part of Image Capture, nothing about scanning.
    The Apple help for Image Capture is so incomplete and counter-intuitive that this is one of those times when it's better to answer the question directly then to dump someone into the top level of Help with no guidance.

  • How to save HTML file with images present in the server to local machine

    Hi all
    In my application i have a option for the user to save HTML files with images present in the server. The HTML file is getting saved but the images are not being saved.
    The code i am using is below :-
    l
                        File fname = new File(filePath);
                        if(!fname.exists())                return;
                        FileInputStream istr = null;
                        OutputStream ostr = null;
                        response.setContentType("application/"+format);
                        response.setHeader("Content-Disposition", "attachment; filename=\"" + fname.getName() + "\";");
                        try { 
                             istr = new FileInputStream(fname);
                             ostr = response.getOutputStream();
                             int curByte=-1;
                             while( (curByte=istr.read()) !=-1)
                                  ostr.write(curByte);
                             ostr.flush();
    Can anyone suggest what i need to do
    regards

    The client should probably parse the html that comes down, and look for <img> links, and request those of the server as well.

  • Pages "save as" format

    i created a photo/text pages document(like a newsletter) with some jpegs,,about 3 pages, i saved and then zipped and sent to a pc user,, well it didnt come out as sent.. how do i save a newletter type doc with text and pictures and in what format so that it can be read and viewed as created, and what program would they read it under. is there a tag at the end of the saved file, like jpg on a picture. thanks in advance for any help that anyone could extend

    You have to go through the Export menu - not Save As... The most common formats to use for Windows exports are PDF (if you want the reader to see the document like you do) or Word Document (if you want the reader to be able to modify the content).
    You are not the first person to be confused by this.

  • Message " not taken care size (format) of image"

    Hello,
    I possess Aperture 3.5.1 and Mac OS X (mavericks) and plug-in Border fx, collection NIK softwave. (My camera is a Canon 6D). I use 2 Internet browser : "safari" and "chrome".
    For several months, very often, when I move on miniatures, in particular after the use of Border fx, the image RAW becomes black with the message " not taken care Size(Format) of image ". I must to leave Aperture, to open him again, to open in full screen the image in error, so that it displays again.
    Have you got a solution?
    Thank you for your help.

    A quick update - I had a 28k jpg, which when saved to the database in the dodgy format is 33k. I found if extract this and save (via ImageIO.write) to disk as a PNG, it is now apparently a 'standard' format (also loads ok in web browser), however the size is 400k! If I load that png file (using ImageIO) off disk and save back (using ImageIO), the size is 33k again and it's reverted to the broken format! How is this so?
    I've found if I load the png and save as jpg, both steps with the old JIMI api, it converts back to a 28k jpg which seems to be totally ok. (We use the Jimi api for conversion of .pict files.)
    Any ideas what is going on?

  • Convert and save video, audio, and images to more than a hundred standard f

    I bought Quicktime pro because it said it could "Convert and save video, audio, and images to more than a hundred standard formats". I have .mov that i took and want to change to an .avi
    I feel stupid but how do i do it? shouldn't there be a "convert" or "save as" button?

    AVI isn't dead, it remains the ONLY format in which any real editing can be performed (ie filters and colors and zooms etc). That said, converting FROM any compressed format like .mov back to an uncompressed format will not restore the information lost in the original compression conversion. Like the man said, you probably won't like the result. If you want to make an AVI to edit artistically, you'll need to go back to the source and re-record it to make an original uncompressed avi (example I use 'DVD to AVI converter' software to recode my homemade DVDs to a huge uncompressed AVI, then play with cutting and cropping and zooming and special effects and color filters, etc in a program such as VirtualDub, an THEN open in QT Pro to convert to MOVs to share).

  • How does the TIFF format compress images?

    When we choose "File> Save As" to save an image to a TIFF file, a TIFF Options dialogue box appears with 4 image compression options( None, LZW, Zip, Jpeg). What is this for? Does the TIFF format compress images? Are they destructive to the image quality? THANK YOU

    If you select no compression, it will take up too much space, guaranteed.  TIFF lets you pick any compression method supported by your program and the viewing program.  Some are lossy, some are lossless.  Most TIFFs tend to be compressed in LZW or ZIP, both of which are lossless.  You can also choose to compress your TIFF using JPEG compression, which is lossy, but I can't imagine why you would do this instead of simply saving as a JPEG file, which is more likely to be properly opened in browsers than a JPEG-compressed TIFF file.
    And in response to one of the previous posts, not all compression throws away details from your file.  Only lossy compression (e.g., JPEG, or in the music area MP3) throws away data.  The lossless compression techniques simply encode the data in fewer bits if possible.  (One important fact not relevant to the web, where you will use 8-bit-per-channel files:  If your photos are 16-bit-per-channel, don't save in LZW compressed format; they will actually become larger than the uncompressed image.)  For a simplified example, if there is a series of 16 pixels of solid white, a losslessly compressed image will have code that says, in effect, 16 pixels of (255,255,255) using an abbreviated code instead of simply listing (255,255,255) sixteen times.  It builds up a directory of byte combinations and can use just a few bytes to refer to many bytes of image data.  Because the coding and decoding is exact, there is no change in the image data when it's opened.
    JPEG is a lossy compression technique that doesn't actually record pixel values at all.  It uses formulas to specify averages and changes within regions.  In effect, it records the fact that a given group of pixels has values centered on X color, and that the upper left is much pinker and the lower right is much greener than the average.  When you pick the degree of quality for JPEG compression, you tell it how small to make the comparison cells.  As you can imagine, if the image has text, tree branches, or other highly contrasty subject matter, this will cause serious weirdness if the comparison cells aren't very small (i.e., you don't have the quality set to max).

  • Save Group Box As Image

    Hello,
    I am having Four charts in one group box and i want to save all four charts as single image.So is it possible to directly save groupbox as an image so that all my charts present in group box gets saved.
    Help me....

    Use the Control.DrawToBitmap method.  You can adjust the Save method to save it to jpg, bmp, or another format if you want.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Using bm As New Bitmap(GroupBox1.Width, GroupBox1.Height)
    GroupBox1.DrawToBitmap(bm, New Rectangle(0, 0, bm.Width, bm.Height))
    bm.Save("C:\TestFolder\GroupBoxImage.png", Imaging.ImageFormat.Png)
    End Using
    End Sub
    If you say it can`t be done then i`ll try it

  • CS5 "save as" format menu changed when creating new document

    Hi,
    When creating a new document in photoshop CS5 i cannot save as a jpeg or png or the other large list of file types i used to have in the save as format menu,
    below is what i used to be able to save as but can only do this when actually opening a jpeg file and not when creating a new document
    this is the options i have now
    i haven't been using photoshop that long and am no genius with pc's so i'm a little lost here, does anyone know why this has happened and if there is a solution to this, your help will be greatly appreciated. my spec are windows 7 64bit, core i7, nvidia 260gtx.

    It looks as if you are creating documents in a format incompatible with certain file types.
    For example, check in the New dialog that it is set for RGB Color – 8-bit.

  • Adobe Reader 9 and XI do not save other formats to PDF.

    I had Adobe Reader 9 on  PC Windows 7. I am sure I used to be able to save other file formats to PDF with Reader, but when I try now, I get the sign saying "The printer name is invalid" and the file wouldn't be saved to PDF. I tried uninstalling Reader 9 and installing Reader XI. Exactly the same thing happens. Does anyone know what this sign means and how the problem can be solved? Any suggestions gratefully received.
    Chris Swanton
    UK

    Adobe Reader doesn't save other formats as PDF.
    You probably had Adobe Acrobat if you remember doing this. They look similar.

  • Why are some jpg images scrambled when they appear in my screen saver?   The same images look fine in Preview and Finder.  Some images appear scrambled in the screen saver 'preview' window and the actual screen saver. Other jpg images look fine.

    Why are some jpg images scrambled when they appear in my screen saver?   The same images look fine in Preview and Finder.  Some images appear scrambled in the screen saver 'preview' window and the actual screen saver. Other jpg images look fine.

    The desktop image is fine, taken from the exact same pool of jpg photos.  However, as soon as the slide show screen saver comes on, the images are scrambled.  What is it about the apple screen saver algorithm that scrambles the pics?

  • Save the stage as image at runtime in projector

    Hi, I m very new to Director. I m using Director MX 2004.
    There is a button and a flash file embedded in the director. Now,
    on clicking the button should open the "Save as" dilogue box and
    save the swf as image. Generally, the program should take the
    screenshot of the projector and should save it as image in the hard
    disk. This function should run in the PC and MAC both.
    This is very urgent. Any kind of help, guide .....all are
    welcome.
    Thanks
    Bharati
    [email protected]

    For a "Save" dialog you could use Buddy API's baGetFilename()
    <
    http://www.mods.com.au>
    To grab a snapshot of the stage, you can use:
    tMember = _movie.newMember(#bitmap)
    tMember.image = _movie.stage.image.duplicate()
    To export the bitmap member you can use the free SharpExport
    xtra:
    <
    http://www.sharp-software.com/products/index.htm#sharpexport>

Maybe you are looking for

  • One of the Video monitors is zoomed in

    Hey Guys, I am using CS3 for Mac. For some reason all the video in the right monitor (pardon my lack of terminology) is zoomed in. I checked the scale on each of these clips and they are all 100%. If I double click them to play in the left monitor it

  • PRE-INSERT TRIGGER

    Dear All, In my pre-insert block Level triiger. I have the followed code. declare l_cnt pls_integer; cursor c1 is select count(1) into l_cnt from jnpp_barcode_master where organization_id = :ctrl_blk.inv_org_id and item_id = :jnpp_grv_lines.item_id a

  • You are not authorized to start the administration workset - GP

    I'm trying to launch the Administration Workset for GPs, to release objects from the "Life and Work Events" GPs from ESS, assigned GP Administrator to user and get the error: "You are not authorized to start the administration workset" Also tried add

  • Only Audio options under Media Kind for Video files

    I am trying to assign a number of video files to media type "Music Video". However, when I Get Info for them, select Option and click on the Media Kind drop down, I only have audio options (Music, Podcast, iTunesU, Audiobook, Voice Memo) and not vide

  • Video performance on external display

    What Apple computer will perform the best on an external display? I am using my Mac mainly for calibrated 1080p video playback. I tend to come to the conclusion that I need a Mac pro for optimal performance on an external display? The mac mini could