Convert tiff images to gif images

i have to convert tiff files to gif files so they can be displayed in a web browser
anybody here has any idea how to do this
my first guest would be to use jai ....
any idea are welcomes

i was able to achieve it in png mode
here is how i did it for others who might have that problem
import java.awt.image.RenderedImage;
import java.awt.image.renderable.ParameterBlock;
import javax.media.jai.JAI;
import com.sun.media.jai.*;
public class test {
public static void ImageToPNG()
String inFile = "your tiff here";
String outFile = "your png result filename here";
// Load the image.
ParameterBlock pb = (new ParameterBlock()).add(inFile);
RenderedImage src = JAI.create("fileload", pb);
RenderedImage transformedImage;
// Scale the image to half its size in each direction
ParameterBlock pb2 = new ParameterBlock();
pb2.addSource(src); // The source is "image"
pb2.add(.5f);
pb2.add(.5f);
pb2.add(0.0f);
pb2.add(0.0f);
transformedImage = JAI.create("scale", pb2, null);
// Store the image as a JFIF file.
pb = (new ParameterBlock()).addSource(src).add(outFile).add("PNG");
JAI.create("filestore", pb);
System.out.println("file resized and created");
public static void main(String [] args) {
     ImageToPNG();
}

Similar Messages

  • How combine a jpeg image & animated gif image & save  it as GIF ?

    i have an jpeg image, & also aminated gif image, how do i place the animated gif image over (in the center of the image) a jpeg image & save it as gif file ??

    First thing you need to do is stop thinking in terms of file formats once the files are in photoshop they are all the same. The exception being vector vs raster. But in this instance the process is rteally the same so 6 on one hand a half a dozen on the other. Or as some would say Tomatoe, tomahtoe(mispelled on purpose).
    The jpeg I would assume is the background image and the gif image is the fore ground object. Open the jpeg, and then place the gif file. As long as the fore ground object has transparency, your job is pretty much done. If not, then it will be up to you to mask what you want to keep vs what you don't and apply that selection to the foregrounds layer as a mask.
    Google the net or skim the users manual for the keywords - mask, selections, quickmask, pen tool, paths. Each of these can in one way or another take care of your issue.
    It would be worth your time to also go through the numerous videos about photoshop and see how its done.
    Either go to adobe tv,
    Itunes podcasts
    or one of the following web sites:
    http://kelbytv.com/
    http://creativesuitepodcast.com/

  • Video to GIF image

    Is there any program that will allow me to take a video and convert it to a GIF image? I'm specifically taking a video of a baseball hitter and I want to break it down into slow motion, similar to what project prospect has done in this post:
    http://projectprospect.com/article/2010/03/20/kyle-drabek-scouting-report

    Hi,
    If you now have 62 individual pics of each frame then in something like PhotoShop Elements that you might have got with a Printer you need to import all the Frames as Layers in one pic.
    Then you select to View only the "first" and then Save As an Animated .gif
    10:18 PM Friday; March 26, 2010
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"

  • Go through this image to gif converter

    Hello!
    public class ImageToGifConverter {
         public static void main(String args[]) {
              try{
                   System.out.println("starting");
                   String file="E:/downloads/animgif/toanimate/4.jpg";
                   Frame f=new Frame("myframe");
                   Image i1=f.getToolkit().getImage(file);
                   Dimension size=getImageDimension(file);
                   // get the pixel data of the input image
                   int[][] snagedData=getPixels(i1,(int)size.getWidth(),(int)size.getHeight());
                   // quantize it to 256 color
                   int[] palette=Quantize.quantizeImage(snagedData,256);
                   int[] tempImgData=getFilteredPixels(palette,snagedData);
                   // get the 256 color image
                   Image tempImage=f.createImage(new MemoryImageSource((int)size.getWidth(), (int)size.getHeight(), tempImgData, 0,(int)size.getWidth()));
                   FileOutputStream fos=new FileOutputStream("e:/downloads/animgif/toanimate/new5.gif");
                   GifEncoder acmeGe=new GifEncoder(tempImage,fos,false);
                   acmeGe.encode();
                   fos.close();
    //               WriteGIF.toFile(i1,"e:/downloads/animgif/toanimate/new1.gif");
                   System.out.println("Encoded Successfully");
              }catch(Exception e) {
                   e.printStackTrace();
         private static int[][] getPixels(Image image,int w,int h) throws IOException {
              image.flush();
              image.getWidth(null);
              image.getHeight(null);
    int pix[] = new int[w * h];
    PixelGrabber grabber = new PixelGrabber(image, 0, 0, w, h, pix, 0, w);
    try {
    if (grabber.grabPixels() != true) {
    throw new IOException("Grabber returned false: " +
    grabber.status());
    } catch (InterruptedException e) {
    e.printStackTrace();
    int pixels[][] = new int[w][h];
    for (int x = w; x-- > 0; ) {
    for (int y = h; y-- > 0;) {
    pixels[x][y] = pix[y * w + x];
         return pixels;
         private static int[] getFilteredPixels(int palette[], int pixels[][]) {
    int w = pixels.length;
    int h = pixels[0].length;
    int pix[] = new int[w * h];
    // convert to RGB
    for (int x = w; x-- > 0; ) {
    for (int y = h; y-- > 0; ) {
    pix[y * w + x] = palette[pixels[x][y]];
    return pix;
    // just to get the image size is there anyother way? becos image.getHeight(null)returns -1
         private static Dimension getImageDimension(String file) throws IOException {
              FileSeekableStream stream=new FileSeekableStream(file);
              RenderedOp srcImage = JAI.create("stream", stream);
              Dimension d=new Dimension(srcImage.getWidth(),srcImage.getHeight());
              stream.close();
              srcImage.dispose();
              return d;
    am using http://www.gurge.com/amd/java/quantize/src/Quantize.java for quantization. also am using Acme.JPM.Encoders.GifEncoder for gifencoding
    It ignores certain colors(replace it with black or grey) while converting to gif and some o/p images look akward.I cant get whats wrong .Any tips or suggestions
    It will be great if I get a good comment
    Thanks in advance

    You could use ImageObserver for the width and height. They are -1 until the image is fully loaded. With ImageObserver your app will be notified when the dimensions are ready.

  • How can i convert an image into gif file as jpeg by using com.sun.image.*

    please help me to convert an image into gif format. i have used sun's impl com.sun.image.code.jpeg package to convert a buffered image into a jpeg file. is there any implementatioln available from sun to handle gif files.

    Many. Try for instance google with 'java image encoders'. Go to the URL http://www.google.com/search?q=java+image+encoders and be amazed of the wonders of modern web search tools.

  • Converting GIF images to JPG - display problems in browser

    I am currently writing a program that uses the ImageIO package (javax.imageio.*) to take GIF and PNG images and convert them to JPG images. The program seems to convert them correctly, especially for the PNG images, but the converted GIF images don't open in a browser. They open just fine in Windows Picture and Fax viewer, but when I try to open them in IE or Firefox, it only diplays the little red 'x'.
    Is anyone familiar enough with Images and the ImageIO package in Java that they may have some insight on why these converted GIF files won't display in a browser.

    Bonjour,
    In my [website|http://iweb.debutersurmac.com>, all the images are JPG files,
    By default iWeb '09 converts images to JPG (yes, it's true)...
    ...unless you use masked images*
    !http://i32.servimg.com/u/f32/09/02/44/99/masked10.jpg!
    Crop your images (with Preview) before you paste them in iWeb. Don't use mask, Unmask an image if it's masked. That's the trick!
    !http://i32.servimg.com/u/f32/09/02/44/99/unmask10.jpg!
    (* images with transparency areas (ex : some PNG and GIF), rotation and shapes in iWeb make also PNG files in your website.)

  • ITunes converts all my GIF images to JPG when I sync my iPhone.

    I have an iPhone and a Mac, and on my iPhone I have noticed that whenever I preview my images, GIF images won't play. They will just sit there, and I can only see one frame of them. I have to send the GIFs to myself through text to see them play, but they are GIF files on my iPhone. But, the recent images that I have downloaded from my iTunes to my iPhone do not show up as GIFs, they show up as JPGs instead. Everytime I sync my photos, the GIFs just randomly get converted into JPG images on my iPhone, and I'm not sure how to stop it from doing that. I don't know any other way to move my images from my Mac onto my iPhone without going through iTunes to do so. Is there a way I can get it to stop converting them to JPGs, or is there another way to put photos from my Mac to my iPhone? Thanks!

    I have an iPhone and a Mac, and on my iPhone I have noticed that whenever I preview my images, GIF images won't play. They will just sit there, and I can only see one frame of them. I have to send the GIFs to myself through text to see them play, but they are GIF files on my iPhone. But, the recent images that I have downloaded from my iTunes to my iPhone do not show up as GIFs, they show up as JPGs instead. Everytime I sync my photos, the GIFs just randomly get converted into JPG images on my iPhone, and I'm not sure how to stop it from doing that. I don't know any other way to move my images from my Mac onto my iPhone without going through iTunes to do so. Is there a way I can get it to stop converting them to JPGs, or is there another way to put photos from my Mac to my iPhone? Thanks!

  • Converted GIF Images Does Not Display In Report

    I have a wmf file that contains an image. I converted the wmf file into a gif using software A. This image displays correctly in Oracle Forms and Reports (9.0.4). I take the same wmf file and use software B to convert the file into a gif. Using the same form and report, the gif image displays in Oracle Forms but doesn't display in Oracle Reports. I don't see why a gif image coverted from software A works properly but not when converted from software B. They are both gif images as a result of the conversion from the same wmf source file.
    The reason I prefer software B is because it's a command line executable and the output is close to the original wmf file. When using the command line executabe from software A to convert the wmf file, the resulting gif file is 1/4 the original size and blocky when resized to the original wmf dimensions.
    Is this an Oracle Reports issue/setting or the converter I'm using?

    Thanks Clare!
    Yes I run IE as Administrator. please find screen shots.
    Also, SQL Server is running in SQL server and windows authentication mode. and when i connect data source in BIDS with windows authentication, test shows success but with another login id ReportServerLogin it does not connect. ReportServerLogin login has
    all rights given and is there as sysadmin.
    please find the screen shots.
    Adnan

  • Converting tiff images into jpeg

    I would like to convert tiff images into jpegs with iphoto. I dont want to duplicate all my photos and then have to delete one by one!
    How do I do this?

    Welcome to the Apple Discussions. The short answer is that you cannot. You will have to export the files via the File->Export->File Export menu option, selecting jpeg as the format and checking the box to include the keywords and comments, and maximum size. Then import the jpgs and delete the tiffs.
    You can get all of the tiff files together by doing a search for .tif. Then do a Select All (Command-A) and go to the export menu. Export all to a folder on the desktop. Import the new jpgs into iPhoto.
    To get rid of the tiffs once the jpgs are imported do another search for the tifs and select all again. Then type Command+Delete. That moves the tiff photos to iPhoto's Trash bin. Then empty the bin.
    If you have multiple files with the same file name you'll have to do some renaming before the export. You can batch rename them using the option Title to Date/Time or just date alone. I use the date taken as the file name as that gives me excellent chronological sorting and searching by filename for dates.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Program to convert MPEG to .GIF image?

    Does anyone know of a (preferably freeware/shareware) program that can convert part of an MPEG movie to an animated GIF image, and where I can download it? Thanks

    I do not know of a program that can do this but you can take screenshots of the parts you want and then use a program like GIFun to compile the animated GIF. A little bit of work but should work.
    Luis

  • I finished making an animated .gif image in FireWorks. My question is, how do I convert it into video so that when I edit video, that every video editing program recognizes it? Long story short, How do I convert animated .gif files into video formats?

    I worked in Adobe FireWorks to make the animated .gif. What program do I use to convert the file from .gif to any video format: .mp4, .m4v, .avi, .wmv, etc. I want to convert it into video format, so that QuickTime Player plays the video, I can insert it into iMovie '11 and edit, and also insert it into Final Cut Pro X and edit video.

    Thanks for getting back with me so promptly.  It has taken me this time to connect with the proper people to find out the information you requested.
    The camera used to film the class was a Panasonic AG-HMC40P, owned by a local cable TV station; they use Kodak video encoding software, and a SD card was used to store the video.   The file extension is .mts, and the mime file is MPEG 2 transport.  He said I probably need an AVCHD converter, and the Mac app store lists 8 of those options, 4 free and 4 for up to $9.99.  He said I'll also need a converter for later plans of posting on YouTube or on the website, and while some of those in the app store might work for the later needs, he knows one app called "Compressor" that would work for the uploading later.  He also suggested I could try renaming the .mts file to .MP2T, but he wasn't sure that would work.
    They don't work with Macs at the studio, but I had thought I could have some lessons there in editing, and apply what I learned to my iMac and iMovie.
    First, though, I have to be able to see it and review it!
    Thanks again!

  • Print label image in GIF format returned by Web Service XML string.

    Hi All
    I have extremely interesting situations and have been struggling with this for a past week. I have been looking everywhere but nobody seems to have an answer. This is my last resort.
    Detail -
    I am consuming UPS web service from my ABAP program. Everything works fine until I have to print UPS label.  The label image is returned to my ABAP program via XML by the UPS reply transaction as a GIF image.
    When I download this image to my PC I can see it and print it, but for the love of god I cannot print this image from my ABAP program. The GIF image is passed to me as a binary data string it looks like bunch on numbers - (2133FFDGFGFGFHHu2026..) very long string about 89800 bites. I cannot use smart forms since smart form requires to have graphic stored in  SAP before smart form print, so this is not possible. I need help figuring out how print GIF image form ABAP or any other SAP method dynamically.  Any ideas are extremely appreciated. I am just puzzled that I cannot find any info on something like this. I cannot be the first one who needs to print GIF image in SAP.

    Hi all,
    I understand this thread was started long back. But wanted to share this solution since I see the same question in many forums without any particular conclusive answer. So the steps I am explaining here, if it helps in some way, I will be really happy. I won't say this is the perfect solution. But it definitely helps us to print the images. This solution is infact implemented successfully in my client place & works fine.
    And please note there may be  better solutions definitely available in ECC6 or other higher releases. This solution is mainly for lesser versions, for people don't have ADOBE forms or other special classes.
    Important thing here is binary string is converted to postscript here. So you need to make sure your printer supports postscripts. (Ofcourse, if anybody is interested, they can do their R&D on PCL conversion in the same way...and pls let me know). Once the binary data is converted to postscript, we are going to write it in the binary spool. so you will still see junk characters (or numberssss) in spool. But when you print it in postscript printer , it should work.
    First step, assuming you have your binary data ready from tiff or pdf based on your requirement.
    Basically below compress/decompress function modules convert the binary data from lt_bin (structure TBL1024) to target_tab (structure SOLIX). From Raw 1024 to Raw 255
    DATA: aux_tab LIKE soli OCCURS 10. - temp table
    Compress table
                  CALL FUNCTION 'TABLE_COMPRESS'
                    TABLES
                      in             = lt_bin
                      out            = aux_tab
                    EXCEPTIONS
                      compress_error = 1
                      OTHERS         = 2.
    Decompress table
                  CALL FUNCTION 'TABLE_DECOMPRESS'
                    TABLES
                      in                   = aux_tab
                      out                  = target_tab
                    EXCEPTIONS
                      compress_error       = 1
                      table_not_compressed = 2
                      OTHERS               = 3.
    In my case, since I have to get it from archived data using function module, ARCHIV_GET_TABLE which gives RAW 1024, above conversion was necessary.
    Second step: Application server temporary files for tif/postscript files.
    We need two file names here for tif file & for converted postscript file. Please keep in mind, if you are running it in background, user should have authorization to read/write/delete this file.
    Logical file name just to make sure the file name is maintainable. Hard code the file name if you don't want to use logical file name.
                  CALL FUNCTION 'FILE_GET_NAME'
                    EXPORTING
                      logical_filename = 'ABCD'
                      parameter_1      = l_title
                      parameter_2      = sy-datum
                      parameter_3      = sy-uzeit
                    IMPORTING
                      file_name        = lv_file_name_init
                    EXCEPTIONS
                      file_not_found   = 1
                      OTHERS           = 2.
                  IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                  ENDIF.
    Now concatenate with the different extensions to get two different files.
                  CONCATENATE lv_file_name_init '.tif' INTO lv_file_name_tif.
                  CONCATENATE lv_file_name_init '.ps' INTO  lv_file_name_ps.
    Third step: Write the target_tab to tif file.
    Open dataset for writing the tif file.
                  OPEN DATASET lv_file_name_tif FOR OUTPUT IN BINARY MODE.
                  IF NOT sy-subrc IS INITIAL.
                    RAISE open_failed.
                  ELSE.
                    LOOP AT target_tab INTO w_target_tab.
                      CATCH SYSTEM-EXCEPTIONS dataset_write_error = 1
                                              OTHERS = 4.
                        TRANSFER w_target_tab TO lv_file_name_tif.
                      ENDCATCH.
                      IF NOT sy-subrc IS INITIAL.
                        RAISE write_failed.
                      ENDIF.
                    ENDLOOP.
                    CATCH SYSTEM-EXCEPTIONS dataset_cant_close = 1
                                            OTHERS = 4.
                      CLOSE DATASET lv_file_name_tif.
                    ENDCATCH.
                  ENDIF.
    Fourth Step: Convert the tiff file to postscript file.
    This is the critical step. Create an external command (SM49/SM69) for this conversion. In this example, Z_TIFF2PS is created. Infact, I did get help from our office basis gurus in this. so I don't have the exact code of this unix script. You can refer the below link or may get some help from unix gurus.
    http://linux.about.com/library/cmd/blcmdl1_tiff2ps.htm
    Since my external command needs .ps file name and .tif file name as input, concatenate it & pass it as additional parameter. Command will take care of the conversion & will generate the .ps file.
       CONCATENATE lv_file_name_ps lv_file_name_tif INTO lw_add SEPARATED BY space.
    Call the external command with the file paths.
                  CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
                    EXPORTING
                      commandname           = 'Command name'
                      additional_parameters = lw_add
                    TABLES
                      exec_protocol         = t_comtab.
    Fifth step: Read the converted ps file and convert it to RAW 255.
      DATA:lw_content TYPE xstring.
    Open dataset for reading the postscript (ps) file
                  OPEN DATASET lv_file_name_ps FOR INPUT IN BINARY MODE.
    Check whether the file is opened successfully
                  IF NOT sy-subrc IS INITIAL.
                    RAISE open_failed.
                  ELSE.
                    READ DATASET lv_file_name_ps INTO lw_content.
                  ENDIF.
    Close the dataset
                  CATCH SYSTEM-EXCEPTIONS dataset_cant_close = 1
                                          OTHERS = 4.
                    CLOSE DATASET lv_file_name_ps.
                  ENDCATCH.
    Make sure you delete the temporary files so that you can reuse the same names again & again for next conversions.
                  DELETE DATASET lv_file_name_tif.
                  DELETE DATASET lv_file_name_ps.
    Convert the postscript file to RAW 255
                  REFRESH target_tab.
                  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
                    EXPORTING
                      buffer     = lw_content
                    TABLES
                      binary_tab = target_tab.
    Sixth step: Write the postscript data to binary spool by passing the correct print parameters.
                  IF NOT target_tab[] IS INITIAL.
                    PERFORM spo_job_open_cust USING l_device
                                                         l_title
                                                         l_handle
                                                         l_spoolid
                                                         lw_nast.
                    LOOP AT target_tab INTO w_target_tab.
                      PERFORM spo_job_write(saplstxw) USING l_handle
                                                            w_target_tab
                                                          l_linewidth.
                    ENDLOOP.
                    PERFORM spo_job_close(saplstxw) USING l_handle
                                                          l_pages.
                    IF sy-subrc EQ 0.
                      MESSAGE i014 WITH
                       'Spools for'(019) lw_final-vbeln
                   'created successfully.Check transaction SP01'(020).
                    ENDIF.
                  ENDIF.
    Please note the parameters when calling function module RSPO_SR_OPEN. Change the print parameters according to your requirement. This is very important.
    FORM spo_job_open_cust USING value(device) LIKE tsp03-padest
                            value(title) LIKE tsp01-rqtitle
                            handle  LIKE sy-tabix
                            spoolid LIKE tsp01-rqident
                            lw_nast TYPE nast.
      DATA: layout LIKE tsp01-rqpaper,
            doctype LIKE tsp01-rqdoctype.
      doctype = 'BIN'.
      layout = 'G_RAW'.
      CALL FUNCTION 'RSPO_SR_OPEN'
          EXPORTING
            dest                   = device "Printer name
        LDEST                  =
            layout                 = layout
        NAME                   =
            suffix1                = 'PDF'
        SUFFIX2                =
        COPIES                 =
         prio                   = '5'
           immediate_print        = 'X'
    immediate_print        = lw_nast-dimme
            auto_delete            = ' '
            titleline              = title
        RECEIVER               =
        DIVISION               =
        AUTHORITY              =
        POSNAME                =
        ACTTIME                =
        LIFETIME               = '8'
            append                 = ' '
            coverpage              = ' '
        CODEPAGE               =
            doctype                = doctype
        ARCHMODE               =
        ARCHPARAMS             =
        TELELAND               =
        TELENUM                =
        TELENUME               =
          IMPORTING
            handle                 = handle
            spoolid                = spoolid
          EXCEPTIONS
            device_missing         = 1
            name_twice             = 2
            no_such_device         = 3
            operation_failed       = 4.
      CASE sy-subrc.
        WHEN 0.
          PERFORM msg_v1(saplstxw) USING 'S'
                           'RSPO_SR_OPEN o.k., Spoolauftrag $'(128)
                           spoolid.
          sy-subrc = 0.
        WHEN 1.
          PERFORM msg_v1(saplstxw)  USING 'E'
                               'RSPO_SR_OPEN Fehler: Gerät fehlt'(129)
                               space.
          sy-subrc = 1.
        WHEN 2.
          PERFORM msg_v1(saplstxw)  USING 'E'
                             'RSPO_SR_OPEN Fehler: Ungültiges Gerät $'(130)
                             device.
          sy-subrc = 1.
        WHEN OTHERS.
          PERFORM msg_v1(saplstxw)  USING 'E'
                               'RSPO_SR_OPEN Fehler: $'(131)
                               sy-subrc.
          sy-subrc = 1.
      ENDCASE.
    ENDFORM.                    "spo_job_open_cust
    Thats it. We are done. If you open the spool, still you will see numbers/junk characters. if you print it in postscript printer, it will be printed correctly. If you try to print it PCL, you will get lot of pages wasted since it will print all junk characters. So please make sure you use postscript printer for this.
    Extra step for mails (if interested):
    Mails should work fine without any extra conversion/external command since it will be opened again using windows. So after the first step (compress & decompress)
    Create attachment notification for each attachment
                  objpack-transf_bin = 'X'.
                  objpack-head_start = 1.
                  objpack-head_num   = 1.
                  objpack-body_start = lv_num + 1.
                  DESCRIBE TABLE  lt_target_tab LINES objpack-body_num.
                  objpack-doc_size   =  objpack-body_num * 255.
                  objpack-body_num = lv_num + objpack-body_num.
                  lv_num = objpack-body_num.
                  objpack-doc_type   =  'TIF'.
                  CONCATENATE 'Attachment_' l_object_id INTO objpack-obj_descr.
                  reclist-receiver = l_email.
                  reclist-rec_type = 'U'.
                  reclist-express = 'X'.
                  APPEND reclist.
                  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                    EXPORTING
                      document_data              = docdata
                      put_in_outbox              = 'X'
                      commit_work                = 'X'
                    TABLES
                      packing_list               = objpack
                      contents_txt               = objtxt
                      contents_hex               = target_tab
                      receivers                  = reclist
                    EXCEPTIONS
                      too_many_receivers         = 1
                      document_not_sent          = 2
                      document_type_not_exist    = 3
                      operation_no_authorization = 4
                      parameter_error            = 5
                      x_error                    = 6
                      enqueue_error              = 7
                      OTHERS                     = 8.
                  IF sy-subrc <> 0.
                    RAISE email_not_sent.
                  ENDIF.
                  COMMIT WORK.
    Hope this helps. I am sure this (print/email both) can be improved further by removing some conversions/by using some other methods.Please check & let me know if you have any such suggestions or any other comments.
    Regards,
    Gokul
    Edited by: Gokul R Nair on Nov 16, 2011 2:59 AM</pre>
    Edited by: Gokul R Nair on Nov 16, 2011 3:01 AM
    Edited by: Gokul R Nair on Nov 16, 2011 3:15 AM

  • Loss transparency in an animated GIF image when resizing

    Hi Friends,
    I have to write a program to resize GIF, JPEG , and PNG images. I wrote and it works but when i resize a GIF file it loses its transparency and give a black color for transparent area.
    I used a GifDecoder found at www.fmsware.com/stuff/GifDecoder.java
    and a gif encoder found at jmge.net/java/gifenc/Gif89a090b.zip.
    i don't know where the problem is .
    i have some small problems in here.
    How can i preserve the transparency of GIF image?
    How can i set a transparent color in Graphic2D object? smtimes it may help me. or error may be in the encoder.
    Help me guys.
    Thanks and regards,
    Manjula

    Java comes with gif encoder/decoders.
    Gifs are indexed images. This means that, for example, each pixel is an 8 bit value that is used to look up the correct 24 bit value in the index table. Gifs handle transparency by allowing one particular pixel value to be nominated as transparent.
    If you just rescale the image then you will likely cause pixels with the magic "transparent" value to change their value and become normal pixels. Alternately pixels that are not transparent may have their values changed such that they are transparent.
    Possibly the easyist solution to to force the image into a full RGBA image. Scale this then perform post processing on the image. I.e convert it back into an indexed image, looking at the values of the alpha channel (prior to making it indexed and if they are high enough then modify the corresponding pixel in the indexed image to have the magic transparent value. Then use Metadata passed to your Image writer to indicate which value is transparent.
    matfud

  • Trouble converting powerpoint files with png images to pdf-Can someone help?

    Hello all,
    In my line of work, I create and modify large sized posters that are created in powerpoint. I would have the files print ready by converting them to pdf. I usually have little to no issues executing this. However, I have been dealing with an issue of converting ppt files with png images. The size of the ppt is typically a 42x56 file. The several ways to convert to pdf produces an error each time. Png images are very useful as they provide much clarity vs jpegs or tiffs. The 3 ways I have tried below are:
    A) File>Print>Adobe PDF>High Quality print settings/300dpi results to an error message that says:
         "Windows cannot print due to a problem with the current print setup. Try one of the following:
         *Check the printer by printing a test page from Windows.
         *Make sure the printer is turned on and online.
         *Reinstall the printer driver"
         A blank pdf opens up (Selected to open file after publishing)
    B) File>Save as> Change file type as a pdf results in nothing happening. No pdf is produced.
    C) Acrobat>Create PDF results to an error message that says: "An unexpected error occured. PDFMaker was unable to produce the Adobe PDF."
    Again, this all happens with ppt files with png images. I took out the png images and attempted to convert to pdf, and the pdf is produced! 
    Can anyone provide any assistance in creating pdfs with png images or what settings I need to adjust? I am able to covert every other image type (jpeg, tiff, bmp), except for png images.
    I am using Microsoft Office 2010 with Adobe Acrobat X on Windows 7 (This happened on Windows XP as well).

    >I have a 48 slide presentation that has a small .png image in the "slide
    >master" so it will show up on every page.
    PowerPoint only has to store one instance of the image even thought it is
    displayed on multiple slides. But Acrobat can't do the same, the image has
    to be stored for every page that it appears on, so that would explain the
    larger file size.
    Acrobat is supposed to be able to optimize the storage of common background
    images (at least that's the message I see when I do a "Save as..."), but I
    have yet to see it to work. Maybe it depends on the application the orginal
    file is created in and the PDF conversion method used.
    Adding the image into a PDF file later as a watermark instead may be a way
    to keep the size down (then it really only does store the object once),
    though I believe that watermark images will appear in front of everything
    else on the page (not sure if that's a problem for you, it depends on
    whether any text or objects in the presentation ever appear in front of the
    image).
    What are the dimensions and resolution of the image in PowerPoint? You may
    be able to go as low as 75 dpi and not notice a difference, it depends on
    whether the image contains any areas of high contrast or text.

  • Converting a BufferedImage to an Image

    I have a program with some BufferedImages that the user needs to be able to drag around the screen.
    1) The dragging process is very sluggish when I use BufferedImages, but not when I use normal Images. Is this normal, or is something wrong with my program?
    2) If using Images is the only way to fix this problem, how do I draw my BufferedImages into Images or convert them to Images? They have to start out as BufferedImages so that they can undergo a one-time rescaling operation.

    Where can I find out what a profiler is and how to use one?
    Here is an abbreviated version of the code. A non-buffered Image is available for dragging here, and it too drags sluggishly unless you eliminate the line of code that draws the BufferedImages to the screen. There is probably something else wrong with this program, because at one point dragging the BufferedImages did work well. When the problem appeared I tore my code apart trying to find out what I had messed up, but after reversing all the recent changes I had not eliminated the problem and was left mystified.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    public class Hanoi2 extends JFrame implements MouseListener, MouseMotionListener, ActionListener{
         private GraphicsDevice device;
         Landscape panel=new Landscape();
         JMenuBar bar=new JMenuBar();
         JMenu menu1=new JMenu("Game");
         JMenuItem m11=new JMenuItem("New Game");
         JMenuItem m12=new JMenuItem("Save Game");
         JMenuItem m13=new JMenuItem("Load Game");
         JMenuItem m14=new JMenuItem("Exit");
         JMenu menu2=new JMenu("Options");
         JMenu m21=new JMenu("Disk Number");
         JRadioButtonMenuItem sm11=new JRadioButtonMenuItem("4");
         JRadioButtonMenuItem sm12=new JRadioButtonMenuItem("5");
         JRadioButtonMenuItem sm13=new JRadioButtonMenuItem("6");
         JRadioButtonMenuItem sm14=new JRadioButtonMenuItem("7");
         JRadioButtonMenuItem sm15=new JRadioButtonMenuItem("8");
         JRadioButtonMenuItem sm16=new JRadioButtonMenuItem("9");
         JRadioButtonMenuItem sm17=new JRadioButtonMenuItem("10");
         JMenu m22=new JMenu("Disk Set");
         JRadioButtonMenuItem sm21=new JRadioButtonMenuItem("Stone");
         JRadioButtonMenuItem sm22=new JRadioButtonMenuItem("Glass");
         JRadioButtonMenuItem sm23=new JRadioButtonMenuItem("Pattern");
         JMenu m23=new JMenu("Backdrop");
         JRadioButtonMenuItem sm31=new JRadioButtonMenuItem("Spirals");
         JRadioButtonMenuItem sm32=new JRadioButtonMenuItem("Stars");
         JRadioButtonMenuItem sm33=new JRadioButtonMenuItem("Dots and Flowers");
         JRadioButtonMenuItem sm34=new JRadioButtonMenuItem("Psychedelic");
         JRadioButtonMenuItem sm35=new JRadioButtonMenuItem("Smart Sky");
         JMenu menu3=new JMenu("Help");
         JMenuItem m31=new JMenuItem("Instructions");
         JMenuItem m32=new JMenuItem("About");
         int numberdisks=4;
         int numberdisksthisgame=0;
         int diskset=0;
         int backdrop=0;
         boolean isgame=false;
         int[] diskstack={-1,-1,-1};
         int[][] poledisks=new int[3][10];
         Image[] backs=new Image[5];
         Image[][] disks=new Image[3][10];
         Image[] poles=new Image[3];
         Image cloth;
         Image company;
         Image title;
         MediaTracker tracker=new MediaTracker(this);
         int[][] diskspot=new int[2][10];
         BufferedImage[][] disksr=new BufferedImage[3][10];
         Graphics2D[][] disksg=new Graphics2D[3][10];
         BufferedImage[] polesr=new BufferedImage[3];
         Graphics2D[] polesg=new Graphics2D[3];
         boolean goer=false;
         public Hanoi2(GraphicsDevice device){
         super(device.getDefaultConfiguration());
         this.device=device;
         setTitle("Tower of Hanoi");
         setDefaultCloseOperation(EXIT_ON_CLOSE);
         title=Toolkit.getDefaultToolkit().getImage("Hanoi/Title.gif");
         company=Toolkit.getDefaultToolkit().getImage("Hanoi/Company.gif");
         cloth=Toolkit.getDefaultToolkit().getImage("Hanoi/clothspread2.gif");
         poles[0]=Toolkit.getDefaultToolkit().getImage("Hanoi/woodpole1.gif");
         poles[1]=Toolkit.getDefaultToolkit().getImage("Hanoi/woodpole2.gif");
         poles[2]=Toolkit.getDefaultToolkit().getImage("Hanoi/woodpole3.gif");
         backs[0]=Toolkit.getDefaultToolkit().getImage("Hanoi/background1.gif");
         backs[1]=Toolkit.getDefaultToolkit().getImage("Hanoi/background2.gif");
         backs[2]=Toolkit.getDefaultToolkit().getImage("Hanoi/background3.gif");
         backs[3]=Toolkit.getDefaultToolkit().getImage("Hanoi/background4.gif");
         backs[4]=Toolkit.getDefaultToolkit().getImage("Hanoi/background5.gif");
         disks[0][0]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone1.gif");
         disks[0][1]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone2.gif");
         disks[0][2]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone3.gif");
         disks[0][3]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone4.gif");
         disks[0][4]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone5.gif");
         disks[0][5]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone6.gif");
         disks[0][6]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone7.gif");
         disks[0][7]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone8.gif");
         disks[0][8]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone9.gif");
         disks[0][9]=Toolkit.getDefaultToolkit().getImage("Hanoi/stone10.gif");
         disks[1][0]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass1.gif");
         disks[1][1]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass2.gif");
         disks[1][2]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass3.gif");
         disks[1][3]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass4.gif");
         disks[1][4]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass5.gif");
         disks[1][5]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass6.gif");
         disks[1][6]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass7.gif");
         disks[1][7]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass8.gif");
         disks[1][8]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass9.gif");
         disks[1][9]=Toolkit.getDefaultToolkit().getImage("Hanoi/glass10.gif");
         disks[2][0]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve1.gif");
         disks[2][1]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve2.gif");
         disks[2][2]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve3.gif");
         disks[2][3]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve4.gif");
         disks[2][4]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve5.gif");
         disks[2][5]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve6.gif");
         disks[2][6]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve7.gif");
         disks[2][7]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve8.gif");
         disks[2][8]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve9.gif");
         disks[2][9]=Toolkit.getDefaultToolkit().getImage("Hanoi/carve10.gif");
         for(int i=0; i<10; i++){
         tracker.addImage(disks[0], 0);
         tracker.addImage(disks[1][i], 0);
         tracker.addImage(disks[2][i], 0);}
         tracker.addImage(poles[0], 0);
         tracker.addImage(poles[2], 0);
         tracker.addImage(poles[1], 0);
         try{
         tracker.waitForID(0);
         }catch(Exception e){}
         tracker.addImage(title, 0);
         tracker.addImage(company, 0);
         tracker.addImage(backs[0], 0);
         tracker.addImage(backs[1], 0);
         tracker.addImage(backs[2], 0);
         tracker.addImage(backs[3], 0);
         tracker.addImage(backs[4], 0);
         tracker.addImage(cloth, 0);
         for(int i=0; i<3; i++){
         polesr[i]=new BufferedImage(11,350,BufferedImage.TYPE_INT_RGB);
         polesg[i]=polesr[i].createGraphics();}
         for(int v=0; v<3; v++){
         for(int i=0; i<10; i++){
         disksr[v][i]=new BufferedImage(65+i*15,35,BufferedImage.TYPE_INT_RGB);
         disksg[v][i]=disksr[v][i].createGraphics();
         int y=0;
         int z=-75;
         int q=0;
         for(int x=0; x<65+i*15+2; x+=2){
         if(65+i*15<81) q=7;
         if((65+i*15>80)&&(65+i*15<111)) q=6;
         if((65+i*15>110)&&(65+i*15<141)) q=4;
         if((65+i*15>140)&&(65+i*15<186)) q=3;
         if(65+i*15>185) q=2;
         if((x<(65+i*15)/8)||(x>(65+i*15)-((65+i*15)/8))) {q=q+3;}
         else if((x<(65+i*15)/4)||(x>(65+i*15)-((65+i*15)/4))) {q=q+2;}
         else if((x<(65+i*15)/3)||(x>(65+i*15)-((65+i*15)/3))) {q=q+1;}
         if(x<(65+i*15)/4) z+=q;
         if(x>=(65+i*15)/4) z-=q;
         BufferedImage bi=new BufferedImage(65+i*15,35,BufferedImage.TYPE_INT_RGB);
         BufferedImage bi2=new BufferedImage(65+i*15,35,BufferedImage.TYPE_INT_RGB);
         Graphics2D big;
         big=bi.createGraphics();
         big.drawImage(disks[v][i],0,0,this);
         RescaleOp rop = new RescaleOp(1.1f,(float)(z), null);
    rop.filter(bi,bi2);
         Rectangle2D.Double rect=new Rectangle2D.Double(65+i*15-x,0,4,35);
         disksg[v][i].setClip(rect);
         disksg[v][i].drawImage(bi2,0,0,this);}
         if((v==2)&&(i==9))
         goer=true;}}
         setJMenuBar(bar);
         bar.add(menu1);
         bar.add(menu2);
         bar.add(menu3);
         menu1.add(m11);
         menu1.add(m12);
         menu1.add(m13);
         menu1.add(m14);
         menu2.add(m21);
         menu2.add(m22);
         menu2.add(m23);
         m11.addActionListener(this);
         m12.addActionListener(this);
         m13.addActionListener(this);
         m14.addActionListener(this);
         ButtonGroup group1 = new ButtonGroup();
         m21.add(sm11);
         m21.add(sm12);
         m21.add(sm13);
         m21.add(sm14);
         m21.add(sm15);
         m21.add(sm16);
         m21.add(sm17);
         group1.add(sm11);
         group1.add(sm12);
         group1.add(sm13);
         group1.add(sm14);
         group1.add(sm15);
         group1.add(sm16);
         group1.add(sm17);
         sm11.addActionListener(this);
         sm12.addActionListener(this);
         sm13.addActionListener(this);
         sm14.addActionListener(this);
         sm15.addActionListener(this);
         sm16.addActionListener(this);
         sm17.addActionListener(this);
         ButtonGroup group2 = new ButtonGroup();
         m22.add(sm21);
         m22.add(sm22);
         m22.add(sm23);
         group2.add(sm21);
         group2.add(sm22);
         group2.add(sm23);
         sm21.addActionListener(this);
         sm22.addActionListener(this);
         sm23.addActionListener(this);
         ButtonGroup group3 = new ButtonGroup();
         m23.add(sm31);
         m23.add(sm32);
         m23.add(sm33);
         m23.add(sm34);
         m23.add(sm35);
         group3.add(sm31);
         group3.add(sm32);
         group3.add(sm33);
         group3.add(sm34);
         group3.add(sm35);
         sm31.addActionListener(this);
         sm32.addActionListener(this);
         sm33.addActionListener(this);
         sm34.addActionListener(this);
         sm35.addActionListener(this);
         menu3.add(m31);
         menu3.add(m32);
         m31.addActionListener(this);
         m32.addActionListener(this);}
         int placex=0;
         int placey=0;
         class Landscape extends JPanel{
         public void paintComponent(Graphics g){
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D) g;
         try{
         tracker.waitForAll();
         }catch (InterruptedException exc){}
         if((tracker.checkAll())&&(goer==true)){
         if(isgame==false){
         g.drawImage(title,68,75,this);
         g.drawImage(company,77,250,this);}
         if(isgame==true){
         g.drawImage(backs[backdrop],0,0,this);
         g.drawImage(cloth,0,462,this);
         g.drawImage(disks[0][0],placex,placey,this);
         for(int i=0; i<10; i++){
         g2.drawImage(disksr[diskset][i],diskspot[0][i],diskspot[1][i],this);}}}}}
         public static void main(String[] args){
         try {
    UIManager.setLookAndFeel(
    UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) { }
         GraphicsEnvironment env = GraphicsEnvironment.
    getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = env.getScreenDevices();
    for (int i = 0; i < 1 /* devices.length */; i++) {
    Hanoi2 box = new Hanoi2(devices[i]);
    box.initComponents(box.getContentPane());
    box.begin();}}
         private void initComponents(Container c) {
         panel.setBackground(new java.awt.Color(201%256, 27%256, 27%256));
         panel.setPreferredSize(new Dimension(696,500));
         setContentPane(panel);}
         public void setVisible(boolean isVis) {
    super.setVisible(isVis);}
         public void begin() {
         addMouseListener(this);
         addMouseMotionListener(this);
         pack();
         setVisible(true);
         setLocationRelativeTo(null);}
         public void actionPerformed(ActionEvent e) {
         if(e.getSource()==m11){
         isgame=true;
         numberdisksthisgame=numberdisks;
         for(int i=0; i<10; i++){
         diskspot[0][i]=25+(9-i)*7;
         diskspot[1][i]=462-numberdisks*35+i*35;}
         repaint();}
    if(e.getSource()==m14){
         System.exit(0);}}
         boolean[] dragdisk={false,false,false,false,false,false,false,false,false,false};
         boolean[] istop={true,false,false,false,false,false,false,false,false,false};
         int xcheck=0;
         int ycheck=0;
         boolean dragother=false;
         int currentpole=0;
         public void mousePressed(MouseEvent e){
         int y=e.getY()-60;
         if(isgame==true){
         if((e.getX()>placex)&&(e.getX()<placex+65)&&(y>placey)&&(y<placey+35)){
         dragother=true;}
         for(int i=0; i<numberdisksthisgame; i++){
         if((e.getX()>diskspot[0][i])&&(e.getX()<diskspot[0][i]+(65+i*15))&&(y>diskspot[1][i])&&
         (y<diskspot[1][i]+35)){
         dragdisk[i]=true;
         xcheck=e.getX()-diskspot[0][i];
         ycheck=y-diskspot[1][i];}}}}
         boolean down=true;
         public void mouseDragged(MouseEvent e){
         int y=e.getY()-60;
         if(dragother==true){
         placex=e.getX();
         placey=y;
         repaint();}
         for(int i=0; i<numberdisksthisgame; i++){
         if((isgame==true)&&(dragdisk[i]==true)){
         diskspot[1][i]=y-ycheck;
         diskspot[0][i]=e.getX()-xcheck;
         repaint();}}}
         int currentpole2=0;
         int[] diskloca={25,250,475};
         public void mouseReleased(MouseEvent e){
         for(int i=0; i<numberdisksthisgame; i++){
         if(dragdisk[i]==true){
         dragdisk[i]=false;}}}
         public void mouseMoved(MouseEvent e){}
         public void mouseEntered(MouseEvent e){}
         public void mouseExited(MouseEvent e){}
         public void mouseClicked(MouseEvent e){}}

Maybe you are looking for

  • HELP!  Leopard & XP Pro are not networking

    Not sure why this is so hard to do! Mac is running 10.5.2. PC is running XP Pro SP2. Both are wirelessly running off a Linksys router. The PC can open the shared files on the Mac. but the Mac can't open the XP shared files. I tried using connect to s

  • Auto Forward to next field?

    I have had this program for a very short time and have created my first form. On the form I am requesting an account # that is between 6 and 7 digits using a total of 7 text fields to separate each character in the account #. Is there a way to have t

  • I want to replace my keyboard?

    Hi Every One my son get command key out and i'm wondring if i should to change all the keyboard? i'm in grand forks, north dakota so if i want to fix that where should i send my laptobe??

  • Office pro 2013 download: setup.exe "module could not be found"

    Have downloaded Microsoft Office Professional 2013 4 times. Takes about 7 minutes. Then when I click on setup.exe, the computer (windows 8.1) asks if I want to let Microsoft make changes to my computer (this is normal for a software download). I say

  • Memory stick icon on desk top

    Don't know where to put this question All of a sudden I cannot get anything showing on my desk top when I plug my memory sticks in to open them. When I remove them it says DEVICE REMOVAL etc. Have I done something stupid? Any help please.