Creating thumnail of an image

how can i creat the thumbname of an image

Hey, i was looking for a solution recently, and found javax.imageio.
Use ImageReader to read image files. If you want to create thumbnails, create a ImageReadParam, and setSourceSubsampling(2,2,0,0) basicly skips every second pixel as its reading the file.
Have a look at ftp://ftp.java.sun.com/docs/j2se1.4/imageio_guide.pdf
very cool.

Similar Messages

  • Create thumnail from image

    Can we create thumbnail from a image in Oracle 11g database?

    The image is stored as blob secure file in oracle 11g database.
    What is the difference between blob and ORDImage?
    Can I create thumbnail from a image and store it in the database?

  • Creating Thumnail

    Hi Friends ...
    I am creating thumnail by this code ...
    public static void createThumbnail(String original, String thumbnail, int maxDim , String format) {
    try {
    Image inImage = new ImageIcon(
    original).getImage();
         double scale = (double)maxDim/(
         double)inImage.getHeight(null);
    if (inImage.getWidth(
    null) > inImage.getHeight(null)) {
    scale = (double)maxDim/(
    double)inImage.getWidth(null);
    int scaledW = (int)(
    scale*inImage.getWidth(null));
    int scaledH = (int)(
    scale*inImage.getHeight(null));
    BufferedImage outImage =
    new BufferedImage(scaledW, scaledH,
    BufferedImage.TYPE_INT_RGB);
    // Set the scale.
    AffineTransform tx =
    new AffineTransform();
    // If the image is smaller than
    //the desired image size,
    // don't bother scaling.
    if (scale < 1.0d) {
    tx.scale(scale, scale);
    // Paint image.
    Graphics2D g2d =
    outImage.createGraphics();
    g2d.drawImage(inImage, tx, null);
    g2d.dispose();
    // JPEG-encode the image
    //and write to file.
    OutputStream os =
    new FileOutputStream(thumbnail);
    /*JPEGImageEncoder encoder =
    JPEGCodec.createJPEGEncoder(os);
    encoder.encode(outImage);*/
    ImageIO.write(outImage , format , os);
    os.flush();
    os.close();
    os = null;
    }catch(Exception e){
    System.out.println("Exception in Creating Thumbnail :" +e);
    PROBLEMS :::
    The problem is that when ever i am updating my original image ..i can;t see the updated thumnail copy of it ..this code always return copy of thumnail that i have created first time during invoketion of code..and subsequent time it return only that copy (First Copy) irespect of original image.update...can any body guess what is happing ..with this ..
    Please give me replay as soon as possible..
    Thanks ADvance..
    Parthiv Patel

    If I understand your problem, it's that after the first time you call this method, it always makes a thumbnail of the original image instead of using the one on disk? If that's the problem it's because the ImageIcon uses Toolkit.getImage, which caches requests for images in a file to return the same image. You need to get the image like this:Image image = Toolkit.getDefaultToolkit().createImage(original);
    if (image == null) return;
    MediaTracker mt = new MediaTracker(new Component());
    mt.addImage(image, 0);
    try { mt.waitForAll(); }
    catch (Exception e) {}

  • Unable to create an encrypted disk image in Lion

    disk utility gives the error Unable to create "Volume.dmg." (error - 60008) when creating an encrypted disk image. I am using the following steps:
        1.    Open disk utility
        2.    Select the disk (internal or external) to create the image on
        3.    Select File>New>Blank Disk Image…
        4.    Save As: 'Volume'
        5.    Name: Volume
        6.    Size: 50GB
        7.    Format: Mac OS Extended (Journaled)
        8.    Encryption: 128-bit AES encryption
        9.    Image Format: read/write disk image
        10.    Click the Create button
        11.    Password dialog appears
        12.    When I enter a password the dialog closes after entering only a few characters i.e. before I've finished typing, and the following error message displays:
    Unable to create "Volume.dmg." (error - 60008)
    I have previously, successfully, created encrypted disk images in Snow Leopard, and I don't know why I can't in Lion
    Does anyone have any ideas?

    Thanks for this Thomas.
    I've tried naming the image differently, but still received the error, I did however try different permutations for the password.
    The error seems to happen if I use a purely numerical password string and occurs on input of the 10th numerical character, if I start with numerical character but use an alpha before the 9th number I can continue and create a password, and I can create a password  if I start with an alpha and switch to numerals after the first alpha character, purely alphabetical passwords are fine too.
    It seems that Lion doesn't like purely numerical passwords greater than 9 characters, whereas Snow Leopard wasn't so fussy. Seems it's a bit of a bug.
    Thanks for your help

  • Unable to create an encrypted disk image with Disk Utility

    Hi:
    With our upgrade to Lion a few weeks ago, we're now unable to create an encrypted disk image of any type using Disk Utility any more. This problem occurs on 3 different machines, and is reproducible whether one is using an internal HD or an external FW HD. We can successfully create nonencrypted disk images.
    This is a duplicate post with all the details here: https://discussions.apple.com/message/18469359#18469359
    We haven't had any luck with a solution trying various permissions fixes as helpfully suggested by other readers in response to the error message # (-60008 error), so I'm hoping that someone else has run across a solution from the encrypted disk image perspective and that this tag line will generate some help.
    Thank you!

    Save As: 01 (on Desktop)
    Name: 01
    Size: 100 MB
    Format: Mac OS Encrypted (Journaled)
    Encryption: 256-bit AES
    Partitions: Single partition- Apple Partition Map
    Image Format: read/write disk image
    At the password window that pops up I enter: 1234567890
    This says password strength is "Weak"
    All works fine
    Then I repeated this using:
    Save As: 02 (on Desktop)
    Name: 02
    Size: 100 MB
    Format: Mac OS Encypted (Journaled)
    Encryption: 256-bit AES
    Partitions: Single partition- Apple Partition Map
    Image Format: read/write disk image
    At the password window that pops up I enter: 1234567890 and when I start to enter the next "1" I get the "Unable to create "02.dmg." (error -60008)
    OS 10.7.4
    Disk Utility Version 12.1.1 (353)

  • Create a new Buffered Image using Raster and ColorModel

    Sorry , I crosspost this message,because no one reply.
    Recently,I write a programme combining C++ and Java .
    The C++ part create a array containing image data in form of BI_RGB and biBitCount==32.
    The java part create a image using Raster and ColorModel like this:
       static int[] data ;
       DataBuffer db = new DataBufferInt(data, data.length);
       WritableRaster wr =Raster.createPackedRaster(db, 1024,768, 32, null);
       ColorModel cm = new DirectColorModel(32,0xff0000,0x00ff00,0x0000ff);
       img = new BufferedImage(cm, wr, false, null);But it doesn't work .
    it report this:
    Exception in thread "main" java.lang.IllegalArgumentException: Raster sun.awt.im
    age.SunWritableRaster@dff3a2 is incompatible with ColorModel DirectColorModel: r
    mask=ff0000 gmask=ff00 bmask=ff amask=0
    at java.awt.image.BufferedImage.<init>(BufferedImage.java:549)
    at monitor.test.Perform2.main(Perform2.java:39)

    hey epico
    compiles & runs 4 me
    see javadocs for SinglePixelPackedSampleModel
    import java.awt.image.*;
    public class Tester {
    DataBuffer db;
    WritableRaster wr;
    ColorModel cm;
    BufferedImage im;
    int[] data;
    int[] masks;
    int w = 768;
    int h = 576;
      public Tester() {
        data = new int[768*576];
        for (int i = 0;i < w*h ;i++ ) {
          data[i] = 0;
        masks = new int[3];
        masks[0] = 0xff0000;
        masks[1] = 0x00ff00;
        masks[2] = 0x0000ff;
        db = new DataBufferInt(data,data.length);
        SinglePixelPackedSampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,w,h,masks);
        cm = new DirectColorModel(32,0xff0000,0x00ff00,0x0000ff);
        wr = Raster.createWritableRaster(sm,db,null);
        im = new BufferedImage(cm,wr,false,null);
      public static void main(String[] args) {
        Tester tester1 = new Tester();
    }

  • How can I create a java.awt.Image from ...

    Hi all,
    How can I create a java.awt.Image from a drawing on a JPanel?
    Thanks.

    JPanel p;
    BufferedImage image =
        new BufferedImage(p.getWidth(), p.getHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = image.createGraphics();
    p.paint(g);
    g.dispose();

  • How can I create a high res image gallery, need to have print res photos for a pressroom section.

    How can I create a high res image gallery, need to have print res photos for a pressroom section.

    If you want Muse to "pass through" your images and not adjust, compress, crop etc - you need to place your images in the lightbox EXACTLY at the right size, pre-cropped and prepped in Photoshop.
    So if your light box is 800x600 the image you're dropping into that must be 800x600 exactly with no effects, rotation etc added to the lightbox frame. This stop Muse fiddling with your images, if they are perfect when inserted and you're not asking Muse to crop, expand, add effects etc. If it's perfect when inserted, Muse SHOULD also leave the resolution alone too, but I have not tried that one, but in theory, it should work.

  • Facing error in creating a provisioning gold image

    Hi All,
    I want to create one middleware gold image for a middleware home in OEM 12c Cloud Control using Provisiong and patching feature. I have set up one software library. Now while creating a middleware gold image in the subsequent steps I am getting the following error my gold image is not getting created.
    The command "/home/orasoaapp/Oracle/Middleware/utils/clone/clone.sh" was not run successfully. The possible causes are:
    1. All the WebLogic product directories (like WebLogic Server, Coherence) were not installed inside this Middleware home.
    2. In case of Windows, some Java or WebLogic processes were running from this Middleware home.
    mine is linux operating system.
    Can anyone tell me what could be the issue??
    Thanks in Advance!!

    Can you provide some more details on how are you creating your Gold image? Are you creating it from a WLS domain menu?
    Can you also explain the topology of your WLS domain as in how many servers/clusters/number of hosts participating etc?
    Also, what version of OEM are you on? is it 12.1.0.2.0?

  • Creating project as Disc Image after 1 1/2 hours it appeared to be finished but there was message that there was a multiplex error.  Checked and no yellow triangles, music on computer,  any ideas.

    Creating project as Disc Image after 1 1/2 hours it appeared to be finished but there was message that there was a multiplex error.  Checked and no yellow triangles, music on computer, and all resources on computer,  any ideas??

    Hi
    And
    • free space on Start-Up hard disk ? How Much ?
    • Brand and type of DVD used
    • Burn Speed ?
    • Did You try to first do a "Save as a DiskImage" ? If so - Did it work ?
    Yours Bengt W

  • How do I create a bootable snapshot image of Lion?

    How do I create a bootable snapshot image of Lion?  In the past, I used disk utilities - restore to create a copy of current hard drive on an external drive.  If there was a problem, kids could boot to external and work until internal drive was fixed.  This proved to be a great solution.  On a new Macbook Pro with Lion,  I get an error when I try.  It says to do a restore from the recovery disk, but the recovery disk says it is a limited function OSX.  I would like a full OSX so they can continue to work and even copy files over if the internal disk is suffering intermittent failures enough not to boot but not enough to keep from copying files.  A few years ago one of the kids had a disk/boot failure duing finals but was able to boot from the external hard drive, copy over what he needed and access the internet so that he could finish the exams.  Time machine is great, but there are instances where you need a quick fix to keep going until the new hard drive arrives.

    I do not run Windows, so I have no idea how to handle that type of situation.
    But, just to be clear: disregarding Windows, the recovery option downloads the OS and installs it. Technically, that is not a clone unless you copy the installer and create a bootable OS with it. A clone is an exact copy of your system including all your apps, user settings, files, etc, etc and will exist on an external hard drive in addition to your system on your internal - that is done with CCC or SuperDuper.
    And, a GUID partition is created in Disk Utility > click on the drive > choose Partition > choose a layout other than what you now have > there will be a clickable Options button below. Click on that and you can choose GUID. Note: partitioning your drive will erase everything on it.

  • Trouble creating a small disk image with Disk Utility

    When I try to create a disk image using Disk Utility the size option for 2.5MB is grayed out and I cannot override this by manually entering the size I want. Ideally, I would like to create a 500KB-1MB size image to store 1 or 2 files that I want encrypted. Thanks for any help.

    Choose a filesystem which isn't journaled to get the 5MB option; if you want to create a 2.5MB image, specify Mac OS Standard or MS-DOS. Some disk formats have a minimum size.
    (41815)

  • Create a single tall image from a multi-page pdf file

    I would like to take a multi-pake pdf file, and have all of the pages "appended" from top to bottom edge to create a single tall image. I am a teacher, and I currently do this by hand, I am then able to annotate the entire page and croll down an entire document inside of Photoshop.
    Here is an example: I have a pdf with 4 pages. Currently I open the pdf in PS, I end up with 4 images; I adjust the vertical canvas size of one of the images to be 4 times it's original size, then one-by-one I copy the contents of each image to that new tall image and move that layer vertically below the previous one. So the result is say a 1024x6400 pixel image.
    I would like to be able to just open the pdf with a script and get this all done in one step.
    Any help is appreciated.

    Thanks again c.pfaffenbichler. I had most of it worked out in my own way before you got back to me, but I wasn't able to get the final naming part down.
    Like I said, I am a math teacher, and I use photoshop as my whiteboard, and draw with a graphics tablet. So I can print to pdf from any program, now I can import any document into photoshop basically to write on it. So this is wonderful. I have never seen another teacher use PS as a whiteboard in class in this way, so I am most likely the only person in my county or state that would need such a script.
    After I got everything worked out, I added some things to the script. Some of my colleagues will use my files as a whiteboard if I send it to them as a tall single page pdf that they can scroll down and write over; so they don't need photoshop. So I have scripted in the saving of that pdf as well. Here are my changes; most of what I changed is in the section commented MY WORK.
    // opens all pages of pdfs cropped to trimbox with set settings and arranges them;
    // 2011, use it at your own risk;
    #target photoshop
    // dialog for pdf-selection;
    var theFiles = app.openDialog();
    if (theFiles) {
         for (var m = 0; m < theFiles.length; m++) {
              var theFile = theFiles[m];
              if (theFile.name.slice(-4) == ".pdf") {
                   var thePdf = openMultipagePDF(theFile);
              else {alert (theFile.name + " is not a pdf-file")}
    ////// function to open all pages of a pdf //////
    ////// influenced by PlaceMultipagePDF.jsx //////
    function openMultipagePDF(myPDFFile) {
    // pdf open options;
         var pdfOpenOpts = new PDFOpenOptions;
         pdfOpenOpts.antiAlias = true;
         pdfOpenOpts.bitsPerChannel = BitsPerChannelType.EIGHT;
         pdfOpenOpts.cropPage = CropToType.MEDIABOX;
         pdfOpenOpts.mode = OpenDocumentMode.RGB;
         pdfOpenOpts.resolution = 247.8;
         pdfOpenOpts.suppressWarnings = true;
         pdfOpenOpts.usePageNumber  = true;
    // change pref;
         var originalRulerUnits = app.preferences.rulerUnits;
         app.preferences.rulerUnits = Units.PIXELS;
    // suppress dialogs;
         var theDialogSettings = app.displayDialogs;
         app.displayDialogs = DialogModes.NO;
    // iterate through pages until fail;
              var myCounter = 1;
              var myBreak = false;
              var theWidth = 0;
              var theHeight = 0;
              while(myBreak == false){
                   pdfOpenOpts.page = myCounter;
                   try {
                        var thePdf = app.open(myPDFFile, pdfOpenOpts);
                        if (thePdf.width > theWidth) {theWidth = thePdf.width};
                        var offset = thePdf.height;
                        thePdf.layers[0].name = myPDFFile.name+"_"+myCounter;
                        if (myCounter == 1) {
                             var theFile = thePdf
                        else {
                             thePdf.layers[0].duplicate(theFile, ElementPlacement.PLACEATBEGINNING);
                             thePdf.close(SaveOptions.DONOTSAVECHANGES)
                        myCounter = myCounter + 1;
                        var theLayer = app.activeDocument.activeLayer;
                        theLayer.translate(0, theHeight);
                        theHeight = theHeight + offset;
                catch (e) {myBreak = true};
    // reset dialogmodes;
    app.displayDialogs = DialogModes.ERROR;
    app.preferences.rulerUnits = originalRulerUnits;
    // resize canvas;
        theFile.resizeCanvas(theWidth, theHeight, AnchorPosition.TOPLEFT);
    //MY WORK
    // merge visible layers (even if there is only one layer)
         try     {
              theFile.mergeVisibleLayers();
              }catch(e) {}
    // create layer, rename, movetobottom, fill white
         theFile.artLayers.add();
         theFile.layers[0].name = "Background";
         theFile.layers[0].move(theFile.layers[1], ElementPlacement.PLACEAFTER);
         var white = new SolidColor();
         white.rgb["hexValue"] = "ffffff";
         theFile.selection.selectAll();
         theFile.selection.fill(white);
    //rename contents layer, add "work" layer for teacher to write on
         theFile.layers[0].name = "Problems";
         theFile.artLayers.add();
         theFile.layers[0].name = "Work";
    //force 2107 width
    //     if(theFile.width != 2107) theFile.resizeImage(UnitValue(2107, "px"), undefined, undefined, ResampleMethod.BICUBIC);
    // force 2048 width
         if(theFile.width != 2048) theFile.resizeImage(UnitValue(2048, "px"), undefined, undefined, ResampleMethod.BICUBIC);
    // save psd;
        psdOpts = new PhotoshopSaveOptions();
        psdOpts.embedColorProfile = true;
        psdOpts.alphaChannels = false;
        psdOpts.layers = true;
        psdOpts.maximizeCompatibility = true;
        var filePathPsd = myPDFFile.path+"/"+myPDFFile.name.slice(0, -4)+".psd";
        if (filePathPsd.exists) filePathPsd.remove();
        theFile.saveAs(File(filePathPsd), psdOpts, false)
    // save pdf whiteboard
        var pdfOpts = new PDFSaveOptions;
        pdfOpts.downSample = PDFResample.NONE;
        pdfOpts.optimizeForWeb = true;
        pdfOpts.PDFCompatibility = PDFCompatibility.PDF15;
        pdfOpts.preserveEditing = false;
        pdfOpts.encoding = PDFEncoding.PDFZIP;
        var filePathPdf = myPDFFile.path+"/"+myPDFFile.name.slice(0, -4)+" Whiteboard.pdf";
        if (filePathPdf.exists) filePathPdf.remove();
        theFile.saveAs(File(filePathPdf), pdfOpts, false)
        theFile.close(SaveOptions.DONOTSAVECHANGES)
    //MY WORK
         return theFile

  • Disk Utility: Creating a new blank image receiving "file too large" error.

    Hello All!
    I'm trying to create a 10GB non-encrypted, non-compressed RW blank image via the disk utility. The DU runs for a few minutes then barfs out "file too large" error. I have over 30GB free on my HDD. I tried with a smaller size of 6GB to no avail. Also tried unsuccessfully to create from a file (about 4 GB). My ultimate goal is to create a case-insensitive image to run an extremely important program needed for high priority work productivity (i.e. WoW). Thanks in advance for any advice! You will be my new best friend if you help me resolve this. =D
    Hollie
    "There are only 10 types of people in this world: Those who understand binary, and those who don't."

    Hi Hollie, and welcome to the forums!
    Have you created images before successfully?
    Is this to/on your boot drive, or an external drive?
    Have you done any Disk/OS maintenance lately?
    We might see if there are some big temp files left or such...
    How much free space is on the HD, where has all the space gone?
    OmniDiskSweeper is now free, and likely the best/easiest...
    http://www.omnigroup.com/applications/omnidisksweeper/
    WhatSize...
    http://www.macupdate.com/info.php/id/13006/
    Disk Inventory X...
    http://www.derlien.com/
    GrandPerspective...
    http://grandperspectiv.sourceforge.net/

  • Creating an Encrypted Disk Image on an External (USB) Drive

    I have an external 600 GB drive (2x 300 GB SATA 3.5" disks in a Thecus N2050 RAID0 external enclosure connected to iMac by USB2) onto which I would like to backup a large amount of data (500 GB).
    I store this external drive away from my home (in the office) and since I cannot guarantee physically locking away the drive I would like to logically lock the drive by placing all the backup data into an encrypted disk image created on that volume.
    I have tried creating an encrypted disk image on my USB volume in Disk Utility (Apple's instructions here) but I experience a number of issues not documented in the Apple article:
    1) I am not presented with a drop-down option for the size of the disk image.
    2) When I go ahead and try to creat the image I am told that the creation was impossible "file or folder does not exist".
    Is it possible to create disk images on USB volumes (I cannot create such a large disk image on my iMac HDD as I do not have sufficient space).
    thanks in advance
    Raf

    I realised that in Disk Utility you must not have any of your mounted drives highlighted in the left hand pane.

Maybe you are looking for

  • Ajuda com o Firefox de um amigo e reprodução de vídeos no Facebook

    Um amigo meu, usa Win 8.1 e acabou de migrar para o FF. Ele relatou que os vídeos de Facebook(os postados diretamente pelo Facebook, não os que rodam através do YT). Ele tem drivers de vídeo e plugin atualizados e consegue ver normalmente vídeo pelo

  • "Ask to buy" requests not appearing in notification center (family sharing)

    I understand that if one misses an "ask to buy" request from a family member from the lock screen, it is supposed to be available in the notification center.  However, these requests are not being logged in my notification center.  There doesn't seem

  • How to connect WAP200 and WRV210

    Hello! I need to connect two dislocated wired ethernet cables (about 50 meters), so i bought one WAP200 (suport AP, bridge mode and repeater mode) and one WRV210. How do i need to configure the routers? I configer WAP200 as AP  and in WRV210 configua

  • Error occured in Updater core in DownloadUpdates

    Running Windows 7 SP1 64-bit on my PC: Creative Cloud says I have 7 updates. I've tried each one and I get "update failed"  with error code 49. The last few lines of DLM_Native.log are: 12/17/14 23:57:06:782 | [WARN] |  |  |  |  | UCErrorHandling | 

  • -= Save array to file =-

    Hi, I need to write big ArrayList to text file, but I can't find how to do it at once. I've tried this conbination: ArrayList alWords = new ArrayList(); OutputStream out = new BufferedOutputStream(     new FileOutputStream("erd.txt")); out.write(alWo