Creation of JPG file

Hi,
I have a jsp page that display's data from the database in html table format.Now i have a button called "image" at the bottom.I want that when the user clicks on the image button a jpg file should be reandered to the user that would contain the table data (from the database) that is displayed in the jsp.
I am fairly new to image creation in java.I know that i need to use the
response.setContentType("image/jpeg"); to render the jpg back to the user but don't know how to write the data that is displayed in the table in the jsp to this jpg file and generate this file and show back to the user.
I also know that i need to use a byte [] but dont know how to do this.
Is there any way to achieve this?Thanks in advance.
Regards,
Aditya

import javax.imageio.*;
import javax.imageio.IIOImage.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.util.*;
public class h
  public static void main( String a[] ) throws Exception
    doit( new FileOutputStream( a[ 0 ] ) );
  static void doit( OutputStream os ) throws Exception
    int                 width0 = 800;
    int                 height0 = 600;
    BufferedImage       sm0 = new BufferedImage( width0, height0, BufferedImage.TYPE_INT_BGR );
    Graphics2D          g0 = sm0.createGraphics();
    ImageIO.write( sm0, "jpg", os );
}

Similar Messages

  • Want to scan to text file on hp oj8600, software indicates only pdf or jpg file creation

    want to scan to text file on hp oj8600, software indicates can do. However printer system software only allows pdf or jpg file type creation.

    Hello @Richf95,
    Welcome to the HP forums.
    I understand that you are trying to save scans as a text file.
    I would like to help.
    PDF has become the standard file type used when scanning/saving a document.
    Most printers will not have text as a default option.
    Try the following:
    Open the HP scan utility
    In the lower left hand corner select 'Create New Shortcut...'
    Name your new short cut. I went with Text.
    In the next window select the file tab.
    In the drop down menu, select Text.
    This should create a shortcut that will allow you to save scans as a .txt file.
    Aardvark1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!

  • 20Mb JPG file - VERY grainy in iPhoto book

    I recently made an 8 1/2 x 11 hardcover photo book in iPhoto, using the files given to me by my wedding photographer.  When the book arrived, most of the prints were excellent.  However, three (out of 90) were quite grainy.  It looked as if they had been fed into Photoshop 3 and converted to 256 colors using a smart dither.  Not grainy, so much as a very, very noticeable 256-color-seeming wandering dither.  I went back to the original files I used to submit the album, and I noticed that, for whatever reason, the three "grainy" photos were all about 25Mb jpg files.  The other 87 pictures, which were extremely clear, were all jpg files under 10Mb.  I also noticed that when the album was sent to Apple upon creation, only about 86Mb was uploaded even though the pictures were all about 6-8 Mb apiece (other than The Big Three).  So it would seem that when the book is being assembled, iPhoto is creating temporary down-sampled versions of the pictures on each page for upload.  If you've got a JPG file that's too big, it would seem that it makes a very bad down-sampled image, which is then reflected on the printed page.
    This first wedding book was for my mom.  I've already ordered a second book for my wife's grandmother (I KNEW I should have waited for my mom's book to arrive first!).  I'll try tinkering with the three 25Mb JPG files to get them down to 8Mb or so, and then put them in the book.
    The upshot of the  story is -- keep your JPG files well under 20Mb if you're going to include them in iPhoto print books!
    BTW this was in iPhoto 2009.

    I didn't realize previewing a photo book was an option -- thanks for the suggestion!  It's not at all obvious (in my opinion) that the PDF you see in the print preview is the same as what is forwarded to the book-printing subcontractor.  It would be nice if Apple could add a "preview book" button in the Buy Book dialog.
    Anyhow, I can see the extreme graininess in the preview as well, so I can see what I can do in Photoshop, maybe with gaussian blur, so that it will look better when we make our next copy of the book.

  • Issue in Creation of XML file from ABAP data

    Hi,
    I need to create a XML file, but am not facing some issues in creation of XML file, the in the required format.
    The required format is
    -<Header1 1st field= u201CValueu201D 2nd field= u201CValueu201D>
       - <Header2 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 10 fields>
              <Header3 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 6 fields/>
              <Header4  1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 4 fields/.>
               <Header5 1st field= u201CValueu201D 2nd field= u201CValueu201Du2026u2026. Upto 6 fields/>
          </Header2>
       </Header1>
    Iu2019m using the call transformation to convert ABAP data to XML file.
    So please anybody can help how to define XML structure in transaction XSLT_TOOL.
    And one more thing, here I need to put the condition to display the Header 3, Header 4, Header 5 values. If there is no record for a particular line item in header 3, 4 & 5, I donu2019t want to display full line items; this is only for Header 3, 4 & 5.
    Please help me in this to get it resolved.

    Hello,
    you can use CALL TRANSFORMATION id, which will create a exact "print" of the ABAP data into the XML.
    If you need to change the structure of XML, you can alter your ABAP structure to match the requirements.
    Of course you can create your own XSLT but that is not that easy to describe and nobody will do that for you around here. If you would like to start with XSLT, you´d better start the search.
    Regards Otto

  • I want to use my Time Capsule as a central 'hub/hard-drive' in order to keep all my working files in one place. I then plan to use my laptops/desktops as peripheral devices for editing and creation of these files. Is it possible? Create a personal cloud?

    I want to use my Time Capsule as a central 'hub/hard-drive' in order to keep all my working files in one place. I then plan to use my laptops/desktops as peripheral devices for editing and creation of these files. Is it possible? To create a personal cloud?
    Can someone advise as to whether i can do the following:
                                Future Internet connection -------------------TIME CAPSULE (containing all files) -------------- Backed up on the WD 2T Hard-drive I have
                                      (not connected yet)                                         I                                                          (*connected to timecapsule physically)
                                                                                                            I
                    I                                         I                                                I                                                              I                                                I
          Macbook Pro                             iMac                                       HP (PC)                                             OLD Macbook Pro                         iPhone
    (used for remote working)       (Used for home working)     (used for heavy CAD and rendering)    (not being used for anything at the moment)        (& iPods)
    I am looking to have all my files in one place as i am hopelessly disorganised. I know the online clouds are a good solution (used Dropbox at work and uni for 3 years) however i am wanting to create my own 'dropbox/icloud' at home. So whenever i get back home with my laptop, any work i have been working on whilst out that day is updated to the timecapsule, and then ultimately as i turn on the other devices, they update to those newer versions of the files. Please tell me that the 3TB time capsule i have can do this, otherwise it feels rather overpriced as a wireless storage device?
    Another note (to those in the know) If i am to be working on large files (REVIT/SOLIDWORKS/KEYSHOT/CREO/AUTOCAD) - is the timecapsule connection good enough to support editing and updating these files?
    I know i may be asking a question that many have before, but as a bit of a technical novice I wanted a clear-cut answer to my specific circumstances. Your help is greatly appreciated.
    (*can i use this WD hard-drive that is connected to the Time Capsule as a back up? so that the time machine back-ups/any back ups are also backed up onto this one? can the WD be a backup for the TC?)
    Kind Regards
    Joe

    The diagram was supposed to look more like this......
    Internet ---------TIME CAPSULE(containing all files) --------WD 2T Harddrive
                                                I
         I                           I                          I                            I                                   I
    Macbook Pro         iMac                 HP (PC)            OLD Macbook Pro           iPhone
    Sorry!
    Regards
    Joe

  • I am suddenly having a problem when trying to open a .tif file in Adobe bridge. The picture opens in firefox. It never did this before. How do I get my .tif and .jpg files to open in bridge?

    I open Photoshop cs5 version of bridge. Go to a folder that contains photos in .tif, ljpg, etc. file types. When I click on a .tif or .jpg file that I want to open in the raw window of bridge (which it has done for the past year) in opens instead in firefox. How do I stop this from happening????

    It sounds like a problem with Photoshop rather than with Firefox. I suggest posting it on their forum @ http://forums.adobe.com/community/photoshop

  • Unable to open JPG file, getting "unknown or invalid JPEG marker was found", help needed

    Info:
    MS Windows 7 Home Premium 64-bit SP1
    Adobe Photoshop 64bit CS5 etxended (Version 12.0 x64)
    So downloaded some JPG files from the web and trying to use some of them as wallpapers. I am able to open them in Windows viewer and some other prgrams but they are the wrong size for my screen so I wanted to change the resolution and opened them into CS5 and sound that some of them would not open. I am getting the following error "Could not complete your request because an unknown or invalid JPEG marker was found" and yet there does not seem to be anything I can do to resolve this to open them into CS5.
    Any thoughts or advice?

    Open them into another viewer, copy, then FIle-New in Photoshop and Paste.
    Photoshop is picky and a file that does not properly follow the JPEG standards could cause this kind of problem.  Other apps are sometimes more forgiving.
    -Noel

  • Print module - exporting to a .jpg file - borderless printing

    I'm attempting to export a picture as an 8 x 10 .jpg file in the Print Module - I want the image to be borderless. I have gone ahead and changed my page setup to reflect the same dimensions, I've removed margins and I've also gone into the Layout section and adjusted my cell size dimensions and removed margins...I can't seem to get two borders to disappear - if it's a portrait image, the sides have white borders and if it's landscape, the top and bottom have white borders.
    Any help would be greatly appreciated. Thanks. If more information is required, let me know. Thanks!

    If your image is not in exact 8x10 (4x5) aspect ratio, you'll need to select the "Zoom to fit" box.
    Phil

  • Error message: "Dreamweaver can't open .jpg files"

    I'm using DW 8, and I have installed the 8.0.2 update. I'm
    having trouble inserting certain JPG images into a site. I get an
    error message pop-up that states "Dreamweaver can't open .jpg
    files". It will allow me to insert some jpg files, but not all of
    them. I've tried drag & drop and going through the Insert menu.
    The files are not large at all. Doesn't appear to be any problem
    with png's or gif's. It's incredibly frustrating. Anyone have any
    suggestions? TIA.

    > why was i taught that all my web images need
    > to be in 72dpi if it doesn't really matter?
    most people suggest 72 because it was an old standard with
    the early
    macintosh DTP programs. For web use it's easier to
    standardize on it because
    when you make an image, you have to put ~some~ number in the
    resolution box
    and it might as well be 72 as any other number. It simplifies
    moving image
    files around in different applications if they are all the
    same resolution.
    For display in a browser, these will all have the same file
    size and display
    size in a web page:
    600x600 pixels at 1dpi
    600x600 pixels at 72dpi
    600x600 pixels at 6000dpi
    It's when they are used in other applications or when a
    direct url like
    /photos/1.jpg is printed out that they may display in the
    resolution, not
    the pixel dimension.
    I came across a page once where the designer always saved his
    images with a
    resolution of 6000 dpi or some other odd number because he
    thought that if
    people dragged the image off the page to save it- most of
    them wouldn't be
    able to resize it. or some other idiot reason maybe.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • How to avoid creation of _(file.*), coping from tiger to pc?

    how to avoid the creation of this file for ever on a pc environment??
    I explain: as i copy any image file, it goes to a spooler directory and that begins instantly to process the file to an OPI server, separating CMYK channels, converting it to high and low resolution...
    but as this _(file) is created (same name and extension, but 0Kb and with this _ underscore in the beggining of it name), it begins to process it, and as it really does not exists as an image itself, it crashes the OPI server, forcing us to restart it...
    and then, you can imagine the mess, because we're a newspaper, with more than 100 machines logged in two cities simultaneously...
    thanks for those who replied last topic I posted about some softwares to delete it! it really worked!!
    but now, can anyone have a clue how to DON'T create this file?
    thanks in advance!
    alex borba
    [email protected]

    I believe that command is supposed to stop the creation .DS_Store files on servers. Also, I think the plist file gets written to the user ~/Library/Pref, it probably ought to exist both there and in the /Library/Pref folder to really work.
    I didn't think the Save for Web option would work for your purposes. I don't believe anything will work except to strip the resource fork off the files before you send them. There is an Applescript that will do it, using a UNIX command in the script. You select a folder, run the Applescript, and it strips the resource fork off all files in the folder and creates a sub-folder called Stripped with resourceless copies of the files in the original:
    -- Strip resource fork and metadata in Tiger for one file.
    -- If a folder is selected creates an unresourced subfolder of the selected folder
    tell application "Finder"
         try
              set aFile to the selection as alias
              set aFolder to the container of aFile
         on error
              display dialog "Select a file"
              return
         end try
         set aFile to the quoted form of POSIX path of aFile
         do shell script "rsync -a " & aFile & " " & aFile & "Stripped; mv " & aFile & "Stripped " & aFile
         update aFolder
    end tell
    The "do shell script" line must be all a single line in Script Editor. It might wrap funny in the browser. Anyway, copy it, paste into Script Editor, hit compile, and save it as an application. I've only fooled with it a little tiny bit, so I'm not sure whether the rsync process would have any strange effects on complex Photoshop and EPS files or not.
    As far as I know the only way to send Mac files without resource forks to a server is to strip them from the files.
    Francine

  • Capture time is not saved into JPG file! (LR 2.0)

    Hi,
    I have this JPG file with no EXIF data whatsoever but I know it's capture time so I went to Metadata » Edit Capture Time and changed the capture time. Now, on Lightroom in the Library module, I can see the capture time there and then I save the metadata with Metadata » Save Metadata to File. However, when I check the file on Windows Explorer, the capture time (or date taken as named by Windows) is not specified at all.
    Why isn't the "Save Metadata do File" working correctly?

    @William Porter
    I don't have that box checked but it shouldn't matter because I'm not talking about exporting new files to update the metadata. I'm talking about updating the files metadata within the files that are already added to the library.
    @Richard Earney
    That option was already checked from the beginning but it's not helping. That's exactly why I don't understand why this is not working.
    Maybe a bug on LR 2.0 Final?

  • File not found error when opening .JPG files in Photoshop CC

    uninstalled and reinstalled photoshop CC and cannot resolve this issue.
    any time i open a .jpg file in photoshop, I get a "Could not complete your request because the file was not found."
    the file is obviously there, so i'm assuming its missing some sort of plugin, which i thought would be resolved when reinstalling photoshop.
    very frustrated and not sure how to fix this.
    running OSX mavericks
    please help

    used bridge, didn't work.
    tried right-click, double click..open in program.
    same error.
    files work in other adobe products.....
    only way to get a jpg in there is to "paste" it in.

  • How can I quickly view pdf files like I can do with Windows Picture and Fax viewer for jpg files?

    How can I quickly view pdf files like I can do with Windows Picture and Fax viewer for jpg files? I need to look at several thousand PDF files. It takes too long to open each one individually. The only thing I could think of is combining them into large groups and then using the Navigation index. But I like the way windows Picture and Fax Viewer does it because you can keep the files separate. Combining PDFs causes loss of individual file names. That would be a problem since I do need to have the individual file names.

    Windows Picture and Fax Viewer is a DLL and is started via a rundll32.exe call and can't be set as an application to handle images in Firefox 3 and later versions.
    Try to set Windows Picture and Fax Viewer as the default viewer in Windows, then it should be listed automatically in the Mozilla Firefox Browse dialog.
    *http://www.winhelponline.com/articles/115/1/Windows-Picture-and-Fax-Viewer-as-the-default-viewer-in-Mozilla-Firefox.html
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • How do I put one logo (saved as bmp or jpg file) on the form

    Hi !
    I have developed some forms and I want to put on the top of each
    form one logo, which is available both as bmp as well as jpg
    file.
    How do I do it ? Meaning which type of field do I need to store
    that logo and where all do I need to declare/define it ?
    Any help will be welcome...
    Shobhit
    null

    In the layout editor
    from the File menu import image
    select your file it will be added to the canvas
    no coding is required
    null

  • How can I delete two .jpg files from my desktop that refuse to be deleted?

    How can I delete two .jpg files from my desktop that refuse to be deleted?

    The two icons refused to be moved to the garbage. The good part in all this is that ater I turned off the computer at night and turned it back on the next morning they were gone!
    Thanks.

Maybe you are looking for

  • Regularly auto creation of sales order

    Hi All, Is it possible to define or set auto creation of sales order ? e.g. there 2000 customers that every biweekly Monday will have sales orders created automatically by system, so the user just only see and copy to delivery or A/R invoice. TIA Rgd

  • Audio not working MacBook Pro 15''

    My internal speakers are not working and seem not to be recognized by the OS. I am running Lion. Under Preferences>Audio there isn't any option for the internal speakers. Headphones are still working.

  • Package header failed verification during sfr package download

    Hello, I am trying to download the package asasfr-5500x-boot-5.3.1-152.pkg. But everytime it comes with an error "Package header failed verification - object of type 'NoneType' has no len() Please verify that the package is not corrupted.Upgrade abor

  • Assigning object of one class to object of another class.

    Hi, How will i assign an object of one class to an object of another class? Ex: ClassX A=some_method(); Now how will I assign the object A of class ClassX to the object 'B' of another class 'ClassY'.

  • Integrating BOBJ XI 3.1 with GRC AC 5.3

    Hi all Has anyone worked on integrating BOBJ with GRC Access Control 5.3. We have been using GRC CUP for access provisioning all the SAP (ECC, BI, Portal) systems. Now, we have integrated SAP Business Objects Enterprise XI 3.1 with our SAP BW system.