How to save .jpg with jdk1.1.4?(help..)

HI...
i know i can use following code to save .jpg with jdk1.4 by using following code:
BufferedImage img; // your working image
ImageIO.write(img, "jpg", new File("save.jpg"));
or
BufferedImage bimg = null;
int w = img.getWidth(null);
int h = img.getHeight(null);
int [] pixels = new int[w * h];
PixelGrabber pg = new PixelGrabber(img,0,0,w,h,pixels,0,w);
try {
pg.grabPixels();
catch(InterruptedException ie) {
ie.printStackTrace();
bimg = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
bimg.setRGB(0,0,w,h,pixels,0,w);
// Encode as a JPEG
FileOutputStream fos = new FileOutputStream("out.jpg");
JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(fos);
jpeg.encode(bimg);
fos.close();
But when i want to recompile with jdk1.1 , what can i do now ?
Do you have any exapmles?
thank you so much...

Sorry I was not in Station!!!!!and hence the delay in replying
Check this example for more details
public WriteImageIW( String filename, String type ) {
try {
int width = 200, height = 200;
int x0 = 20, y0 = 20, x1 = width-20, y1 = width-20;
BufferedImage bi = new BufferedImage( width, height,
BufferedImage.TYPE_INT_ARGB );
Graphics2D ig2 = bi.createGraphics();
GradientPaint paint =
new GradientPaint( x0, y0, Color.white, x1, y1, Color.black );
ig2.setPaint( paint );
ig2.fillRect( 0, 0, width-1, height-1 );
BasicStroke stroke = new BasicStroke( 10, BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND );
ig2.setPaint( Color.lightGray );
ig2.setStroke( stroke );
ig2.draw( new Ellipse2D.Double( x0, y0, x1-x0, y1-y0 ) );
Font font = new Font( "TimesRoman", Font.BOLD, 20 );
ig2.setFont( font );
String message = "Java2D!";
FontMetrics fontMetrics = ig2.getFontMetrics();
int stringWidth = fontMetrics.stringWidth( message );
int stringHeight = fontMetrics.getAscent();
ig2.setPaint( Color.black );
ig2.drawString( message, (width-stringWidth)/2,
height/2+stringHeight/4 );
Iterator imageWriters =
ImageIO.getImageWritersByFormatName( type );
ImageWriter imageWriter = (ImageWriter)imageWriters.next();
File file = new File( filename );
ImageOutputStream ios =
ImageIO.createImageOutputStream( file );
imageWriter.setOutput( ios );
imageWriter.write( bi );
} catch( IOException ie ) {
ie.printStackTrace();
the file is being created, the type of the file must be specified on the command line.

Similar Messages

  • How to start weblogic with jdk1.4.0

    anybody can tell how to start weblogic with jdk1.4.0 correctly?

    "jacky" <[email protected]> wrote in message news:<[email protected]>...
    anybody can tell how to start weblogic with jdk1.4.0 correctly?Take a look at:
    http://www.genuitec.com/products/JDK14_WLS61.pdf

  • How to supplant JPG with RAW file weeks later?

    Hi there-
    When the Canon S95 came out LR3 didnt recognize or import the RAW .cr2 files. When using the camera I would take photos in both RAW and JPG, use LR3 to import the JPGs and manually copy the .CR2s to a separate directory. I would then tag and otherwise work on the JPGs in my main photo directory in LR3, while the CR2s gathered dust in a different directory.
    Now that LR3 does support .CR2, and I have a slow day, is there an easy way to replace all of those JPGs with the relevant RAW file? What happens to the current XMP data, as ideally with the exception of the file extension they will be named the same.
    Any suggestions would be great. Thanks.

    Another way that will recover your develop settings too: Note: I've never tried this - may have missed something, but in case you're game..
    1. Save all jpeg metadata using Ctrl/Cmd-S (saves develop settings too).
    2. Use exiftool to extract all xmp from jpegs to xmp file making sure it will have the same base name as your CR2s.
        The command is something like:     exiftool -xmp -b my.jpg > my.xmp
    3. Import the CR2s, or if already imported, do a 'Read Metadata'.
    That will transfer all settings from jpegs to CR2 but will make them look unsharp and dull, due to differences in default settings for the two (and in-camera settings). Plus, camera profiles and white balance will not carry over, so you'll have to redo those manually. Also, you may have to set the tone curve to medium instead of linear - not sure about that one.
    Then use DevAdjust to adjust the following settings relatively:
    Sharpening +25
    Sharpen Detail +25
    Brightness +50
    Contrast +25
    Color NR 25 (can be set absolutely)
    Then use CollectionPreseter to set luminance noise reduction based on ISO.
    They should look about the same now, since all settings have the same weight, just different starting points, for everything except temperature and tint.
    And you'll probably want to enable the profile based lens corrections for the CR2s.
    Maybe use compare view to see how you did and fine tune...
    If you dont have a lot of jpegs or didnt make many adjustments this may be more trouble than worth, but in case it helps...
    R

  • How to save file with the "/" symbol in the name?

    Hi,
    I have Adobe Professional 8.  I need to save files with names that include the symbol /, but Adobe interprets, for example, A/88/6, as file name 6, in a folder named 88, in a folder named A, and sets up new folders to accommodate that.  I cannot substitute another symbol as I already have thousands of pdf files in a database using the / symbol, and I need them in the same folders.
    I would very greatly appreciate any advice,
    thanks,
    Mo.

    Thanks.
    As I said, I'm pretty ignorant about these things.  I wouldn't know how to begin using a "hack".  All I know is that I was able, for over a year, to save .pdf files directly from my browser on several computers, and use the forbidden "/" symbol in every file name.  After saving the files, Adobe will happily open them, and allow me to edit and re-save them, although I now see that it will not allow me to "save as" them under a different name without removing that symbol.
    I may not be tech-savvy, but I can state that everything I have said here and above is entirely accurate.  I would be happy to open a dropbox account to show you countless .pdfs with the symbol "/" in the name.
    This is honestly not that big a deal.  I greatly appreciate this discussion, and you have inspired me to become slightly less computer-ignorant.
    Hope you all had a great New Year.  I am still recovering.
    Cheers,
    Mo.

  • How to save layers with cropping?

    I want to export layers to files (basically what "Export Layers To Files.jsx" does) but with cropping each layer (to different sizes). I know how to crop a document from script, but that also crops all other layers (erases their content outside of the cropping area). So my question is - how do I keep/retrieve the cropped out content of the document (layers)? Or maybe there's a better approach altogether?

    Seems to me that you only need to keep the cropped pixels because of way you want to do this.
    However if you want to do it this way you could create a history snapshot, crop and save the first layer. Then restore the document using the snapshot and crop and save the second.
    Or you may be able to just store the current history state in a variable then restore the document using that history state if you are only using a few history states to crop and save.
    With a snapshot you don't have to worry about the number of history states but it needs action manager. Storing the current history state can be done using the DOM.

  • How to save layout with ALV Pivot format

    Hi
    In ALV report I have  25 fields but I want to use 10 fields out of 25 fields in Pivot Table. My problem is how to save this layout with Pivot format for on going use. At every time execution of report I need not required to set  Pivot Table.
    Please help me.
    -Sanjay

    Hi,
    Are you using FM REUSE_ALV_GRID_DISPLAY? If yes, then pass 'X' to the parameter I_SAVE while calling the fm.
    if you are using Object Oriented ALV, then call the below method before calling the method for display
    DATA : gr_layout TYPE REF TO cl_salv_layout,
           gr_layout_key TYPE salv_s_layout_key.
    CALL METHOD gr_functions->set_all
      EXPORTING
        value  = IF_SALV_C_BOOL_SAP=>TRUE.
      MOVE sy-repid TO gr_layout_key-report.
      CALL METHOD gr_table->get_layout
        RECEIVING
          value = gr_layout.
      CALL METHOD gr_layout->set_key
        EXPORTING
          value = gr_layout_key.
      CALL METHOD gr_layout->set_save_restriction
        EXPORTING
          value = if_salv_c_layout=>restrict_none.
      CALL METHOD gr_layout->set_default
        EXPORTING
          value = if_salv_c_bool_sap=>true.
    Regards
    Vinod
    Edited by: Vinod Kumar on Jul 2, 2010 3:40 PM
    Edited by: Vinod Kumar on Jul 2, 2010 4:43 PM

  • How to save Solo with the Song?

    Hi,
    When I activate solo on some tracks, save the song and open it again, solo is not active anymore, so that it blows off my speakers when I start playing and forget to activate solo again.
    How to save solo activation?
    Thanks for any help.

    Werner Zervas wrote:
    Hi,
    When I activate solo on some tracks, save the song and open it again, solo is not active anymore, so that it blows off my speakers when I start playing and forget to activate solo again.
    How to save solo activation?
    Thanks for any help.
    Solo is a momentary button.
    And, do you have ANYTHING between your speakers and the computer's audio otuput?
    You should have some sort of mixer / monitoring thing that has a volume knob, so you don't kill your ears.

  • HT5622 hi sir i will create apple id but at the time of sign in it reply this id cannot use, at review show payment method and another one is code how i can use with out payment plz help me

    how to use apple with out payament methods

    Either redeem an iTunes gift card; use a credit card; or follow the directions here to create a new Apple ID without a credit card:
    http://support.apple.com/kb/ht2534

  • How to Integrate Portal with SAP OFFICE(Please help me)

    Hello Experts,
    I have doubts on Portal and SAP office..
    Please find the
    1) How to show the document info record(DIS,like cv03n or cv04n) in Portal
    Please let me know the step by step procedure...
    2) After showing the documnet info record(DIS) in the portal,If user clicks on
    original attachmnet of documnet info record(DIS) it shoud show the drawing
    or diagam in the word or any uformat using SAP OFFCIE:
    How to Integrate Portal with SAP OFFICE
    Please let me know the details.
    Please mail me any documents related to this to my mail id
    [email protected]
    Thnaks in Advance
    Preethi DSouza

    Hi Dharani,
    Please check this thread.
    How will do the connectivity with SAP and Non Sap System
    Also ensure you avoid cross-posting. This has been mentioned to you multiple times earlier.
    Cheers,
    Sandeep Tudumu

  • Hi apple am new user to apple i just bought i phone 4s  and  i set up passowrd and forgot it how  and the iphone is not responding now how can i deal with this broblem please helpe

    hi apple am new user to apple i just bought i phone 4s  and  i set up passowrd and forgot it how  and the iphone is not responding now how can i deal with this broblem please helpe

    iPhone User Guide (For iOS 5.1 Software)

  • How to: Save jpg frames to swf animation.

    I create signatures for my friends to use in posts on forums
    at the end of their messages.
    Examples here:
    http://s12.invisionfree.com/venvenaevici
    Recently I decided to try animation, but saving in gif format
    isnt allowing me to save with as much detail as I would like and
    the backgrounds are comming out grainy and not smooth. After a
    weeks worth of trouble shooting I think my solution is to save the
    several .jpg files I have refined into a flash, but I dont know how
    to do that. Can anyone help?
    Also when it is saved I would like it to auto play and loop
    like this gif animation I have. If only I could get it to save as
    it looks on preview, or if I had proper training :/
    Animation Example:
    http://w3.the-kgb.com/venvenae/shalieeani.gif
    Background Example without the animation of above:
    http://w3.the-kgb.com/venvenae/shaliee.jpg
    The program I used to get the animation frames in the first
    place is called wow model viewer. Any assistance would be wonderful
    and much appreciated and I would be willing to do a signature for
    someone here that has helped me, if there is interst.
    I wasnt sure where to post this. Im sorry if its in the wrong
    place.

    Sorry I was not in Station!!!!!and hence the delay in replying
    Check this example for more details
    public WriteImageIW( String filename, String type ) {
    try {
    int width = 200, height = 200;
    int x0 = 20, y0 = 20, x1 = width-20, y1 = width-20;
    BufferedImage bi = new BufferedImage( width, height,
    BufferedImage.TYPE_INT_ARGB );
    Graphics2D ig2 = bi.createGraphics();
    GradientPaint paint =
    new GradientPaint( x0, y0, Color.white, x1, y1, Color.black );
    ig2.setPaint( paint );
    ig2.fillRect( 0, 0, width-1, height-1 );
    BasicStroke stroke = new BasicStroke( 10, BasicStroke.CAP_ROUND,
    BasicStroke.JOIN_ROUND );
    ig2.setPaint( Color.lightGray );
    ig2.setStroke( stroke );
    ig2.draw( new Ellipse2D.Double( x0, y0, x1-x0, y1-y0 ) );
    Font font = new Font( "TimesRoman", Font.BOLD, 20 );
    ig2.setFont( font );
    String message = "Java2D!";
    FontMetrics fontMetrics = ig2.getFontMetrics();
    int stringWidth = fontMetrics.stringWidth( message );
    int stringHeight = fontMetrics.getAscent();
    ig2.setPaint( Color.black );
    ig2.drawString( message, (width-stringWidth)/2,
    height/2+stringHeight/4 );
    Iterator imageWriters =
    ImageIO.getImageWritersByFormatName( type );
    ImageWriter imageWriter = (ImageWriter)imageWriters.next();
    File file = new File( filename );
    ImageOutputStream ios =
    ImageIO.createImageOutputStream( file );
    imageWriter.setOutput( ios );
    imageWriter.write( bi );
    } catch( IOException ie ) {
    ie.printStackTrace();
    the file is being created, the type of the file must be specified on the command line.

  • Save jpg with non square pixels

    How do I save as jpg and retain the non square pixels?
    Thank You,
    Tom

    t_Mc wrote:
    You are never going to actually see a non-square pixel JPG image on your square pixel computer monitor.
    Well, I just showed you one.
    No you did not. Our displays only show square pixels.
    t_Mc wrote:
    WHY?
    Are you yelling?
    Where will this image appear? Why do you need PAR if it looks "perfect" on the web without it? What is your output intent? 800x533 is not a video dimension.
    That is not important.
    I asked WHY because you started this discussion with extreme ambiguity. Others have typed many words to try to help you but you have helped no one in return by explaining yourself and what you are trying to do.
    t_Mc wrote:
    Eh... you (and every other photographer with javascript gimmicks) may want to re-evaluate how you post and "protect" images. PAR is not much of a step up from what you have.
    You making RUDE assumptions that are ridiculous This is only the second question I have asked. Thanks for the help lady!
    If I wanted to be rude, I would let you continue to waste your time on pointless techniques that really do not protect your images.
    You can prevent others from making assumptions by...
    fully explaining what you are trying to do!
    EDIT: oy, kids!

  • How to save pictures with the config file "Write Key.vi"

    hi all,
    On my front panel I've few controls pictures containing photos (JPG type) . The user can select the photo he wants using the classic file dialog box.
    Usally I use the config files VI's to save the control values from one run to another one. In the config files VIs, I use the polymorphic "write Key.vi" wich accept only booean, I32, U32, path, and string dada type, but no picture !
    I've tried the "flatten to string" fonction (picture --> flatten to string --> writekey.vi) , no broken wire but the conversion is very very too long and to heavy (20Mo a key!).
    another way, would be to write in a xml file, I've also tried but I've always get the 1104 error: No end tag was found for an XML start/end tag pair.
    can someone help me.
    what is the best way for  retrieving controls pictures with photos

    Hi GerdW
    Many thanks for your quick answer. Always happy to get advises from fellow programmers.
    You suggest to use the "path" input of the "write key.vi" (configuration file utilities) to retrieve photos that a user would have selected in a previous run. Could be a good solution in a number of applications but what I would like to do is like in a excel or word file. Once a photo has been embeded in one xls file for ex., I find it back each time i open this xls file, even if the original photo's file has been deleted or if my application runs on another computer.
    xml file looks interesting for that purpose (i mean used as config file). I can easily store in a xml file a labview picture (like a colored rectangle e.g.) but when i try with a photo (wich is a also a picture) labview returns always the error 1104.
    How to fixe this error, or maybe  there is another way to store photos in a config file without passing through xml,
    kind regards.

  • How to save Jobs with different priority level in a Queue?

    Hi, Friends,
    I have a set of Job (see below) objects.
    I would make a queue: if they have the save priority level, first in and first out. this is easy to do by ArrayList. however, If they have different priority level, I would like make the Jobs with the highest level first out.
    How can I implemented this idea in Java?
    Regards,
    Youbin
    public class Job {
    private short _priorityLevel = 0;
    public void setPriorityLevel(short priorityLevel) {
    this._priorityLevel = priorityLevel;
    public short getPriorityLevel() {
    return _priorityLevel;

    Hi,
    Here is my test code, it works:
    public class Job implements Comparable{
    private int _priorityLevel=0;
    private String _jobDescription=null;
    public Job() {
    public void setPriorityLevel(int priorityLevel) {
    this._priorityLevel=priorityLevel;
    public int getPriorityLevel() {
    return this._priorityLevel;
    public void setJobDescription(String jobDescription) {
    this._jobDescription=jobDescription;
    public String getJobDescription() {
    return this._jobDescription;
    public int compareTo(Object obj) {
    return (this._priorityLevel-((Job)obj)._priorityLevel);
    import java.util.LinkedList;
    import java.util.Iterator;
    import java.util.Collections;
    import java.util.Collection;
    public class test {
    public test() {
    public static void main(String[] args) {
    Job job1 = new Job();
    job1.setJobDescription("Job1");
    job1.setPriorityLevel(2);
    Job job2 = new Job();
    job2.setJobDescription("Job2");
    job2.setPriorityLevel(2);
    Job job3 = new Job();
    job3.setJobDescription("Job3");
    job3.setPriorityLevel(2);
    Job job4 = new Job();
    job4.setJobDescription("Job4");
    job4.setPriorityLevel(1);
    Job job5 = new Job();
    job5.setJobDescription("Job5");
    job5.setPriorityLevel(1);
    Job job6 = new Job();
    job6.setJobDescription("Job6");
    job6.setPriorityLevel(1);
    LinkedList linkedList = new LinkedList();
    linkedList.addLast(job1);
    linkedList.addLast(job2);
    linkedList.addLast(job4);
    Iterator ite=linkedList.iterator();
    while (ite.hasNext()) {
    System.out.println(((Job)ite.next()).getJobDescription());
    System.out.println("---------");
    Collections.sort(linkedList);
    ite=linkedList.iterator();
    while (ite.hasNext()) {
    System.out.println(((Job)ite.next()).getJobDescription());
    System.out.println("---------");
    linkedList.addLast(job3);
    ite=linkedList.iterator();
    while (ite.hasNext()) {
    System.out.println(((Job)ite.next()).getJobDescription());
    System.out.println("---------");
    Collections.sort(linkedList);
    ite=linkedList.iterator();
    while (ite.hasNext()) {
    System.out.println(((Job)ite.next()).getJobDescription());
    System.out.println("---------");
    linkedList.addLast(job5);
    linkedList.addLast(job6);
    ite=linkedList.iterator();
    while (ite.hasNext()) {
    System.out.println(((Job)ite.next()).getJobDescription());
    System.out.println("---------");
    Collections.sort(linkedList);
    ite=linkedList.iterator();
    while (ite.hasNext()) {
    System.out.println(((Job)ite.next()).getJobDescription());
    }

  • How to save PDF with fields so someone can fill out form and send it to printer

    Using Adobe Acrobat X for Mac, I built a pdf template with fields for
    sending an assortment of Business Card files to the printer to print.
    How do I save the file so my brother/client can start typing in different
    names, job titles, and contact info and send them to a printer.
    Thanks,
    jsorlean

    Create your form.
    go to advanced menu
    choose the item about Reader Rights
    when open set what you want Reader to be allowed to do.
    Once set and saved the can fillout, save, email but they can not change the actual form itself just the contents they added.
    Not there is a cap of 500 hundred instances per different PDF.
    (Please note information is given by an Experienced User of Acrobat. I am not an employee of Adobe.)

Maybe you are looking for

  • What is the best practice to manage versions in XI?

    Hi! Is there any <b>good</b> “best practice” ways to manage versions in XI. Have a challenging scenario with many legacy systems and many interfaces per legacy system. Should I put all the different interfaces for one legacy system under one namespac

  • Cannot connect to the TV

    I have been trying to connect my Mac to the TV and cannot get it to work. I have the cables and settings but it won't communicate. When the Mac is connected to the TV and the computer is selected, a blue screen flashes then it goes back to the screen

  • Swapping from laptop to mac book

    Swapping from laptop to mac book how can i load my photo elements12 onto my mac book which has no disc drive? as have photo elements on disc

  • SSH on Solaris 2.5.1

    I was looking for a patch for Solaris 2.5.1 to enable SSH ( I could not migrate to Solaris 8 or 9 due to unsuported OS for some applications ). Did someone know if there is such patch ?

  • HT5312 Forgot my security question answers?

    Set up an itunes account a hundred years ago, and just today bought an iphone.  Wants my security answers to let me buy apps, but I can't get the answers right and it has locked me out.  I thought there would be some sort of verification email, but t