Creating a thumbnail replaces original image

Hi,
Currently fighting with Intermedia on a 9i server trying to create image thumbnails. My DBA's are still setting up the EXPROC for processing JPEG images so I'm working with PNG and BMPs at the moment. I'm use the following stored procedure:
PROCEDURE CREATE_BUDDY_THUMBNAIL (BID IN NUMBER) IS
    Thumb ORDSYS.ORDimage;
    Pic ORDSYS.ORDimage;
BEGIN
  SELECT picture INTO Pic
  FROM BUDDY
  WHERE BUDDY_ID = BID
  FOR UPDATE;
  Thumb := ORDSYS.ORDImage.init();
  IF Pic IS NOT NULL THEN
    Pic.processCopy('maxScale=80 80', Thumb);
    UPDATE BUDDY SET
    thumbnail = Thumb
    WHERE BUDDY_ID = BID;
  END IF;
END;Which is all well and good the thumbnail gets created if I comment out the line "Thumb := ORDSYS.ORDImage.init();" and make Thumb := Picture before doing anything but it also ruins the orignal image - seems to make it the same size as the original but with the data of the thumbnail.
As is, the code generates this error (#13 is the processCopy line):
ERROR at line 1:
ORA-29400: data cartridge error
IMG-00710: unable to write to destination image
ORA-06512: at "ORDSYS.ORDIMG_PKG", line 525
ORA-06512: at "ORDSYS.ORDIMAGE", line 59
ORA-06512: at "CMS_KIOSK.CREATE_BUDDY_THUMBNAIL", line 13
ORA-06512: at line 1
I'm assuming/hoping Christian is having a similar problem here: How to create ordsys.ordimage object? - I've used the ini() line from his example. Help appreciated, was hoping this would be simple as...

Hi,
if you want to store your thumbnail in your database you should try to bind thumb to the database object directly. It should look something like this:
PROCEDURE CREATE_BUDDY_THUMBNAIL (BID IN NUMBER) IS
Thumb ORDSYS.ORDimage;
Pic ORDSYS.ORDimage;
BEGIN
SELECT picture, thumbnail INTO Pic, Thumb
FROM BUDDY
WHERE BUDDY_ID = BID
FOR UPDATE;
IF Pic IS NOT NULL THEN
Pic.processCopy('maxScale=80 80', Thumb);
UPDATE BUDDY SET
thumbnail = Thumb
WHERE BUDDY_ID = BID;
END IF;
END;
Thumbnail should already be initialized by ORDImage.init(), when you call the procedure. I tried code like this using java and it worked fine for me. So it should work in PL/SQL too.
But it's not a solution for my problem. :(

Similar Messages

  • Ordering Prints: Thumbnail shows original image and does not show edits. Will edits be printed?

    When ordering a print, the thumbnail shows the original image without any iPhoto edits.  Is this a bug?  How can I make sure my prints will come out with edits?

    The thumbnail should reflect any edits made unless they were made with a 3rd party editor incorrectly. How did you edit the photos?  With iPhoto or a 3rd party editor? 
    OT

  • Creating square thumbnails from both landscape & portrait images

    I make regular use of a Flash image gallery that requires me to provide small square 50 x 50px thumbnails whatever the shape of the original images. The only solution I have found so far is to first manually sort my original images into landscape and portrait folders and then run a different action on each folder to create the thumbnails.
    Is there any way to design an action that would work equally well on both landscape and portrait images?
    David

    he will do a centered 1;1
    David C Anderson wrote:
    JJMack,
    I am confused. You said that your CraftedActions package has a plug-in script you can use in Actions to do a 1:1 center crop and you said the name of the relevant action was AspectRatioSelection. I have loaded CraftedActions into Actions but cannot see anything called AspectRatioSelection. Please clarify.
    There is no Action for cropping. There are 12 scripts in the package *.jsx they go into Photoshop's scripting Path. Like PSversion\presets\scripts\
    On of the scripts has the name AspectRatioSelection.jsx it is a Plug-in script it does not crop it can set AspectRatioSelection and make AspectRatioPath they can be rectangular or ellipse. You can record a Cropping action using it.  Takes two steps.
    Step 1 menu File>Automate>Aspect Ratio Selection...  in the dialog set it like this
    Follow that step with Step 2 menu Image>Crop
    That will do the largest 1:1 centered crop possible. You can follow that with a Image Size or Automate fit image and set width and height to 50PX
    That would look like this note red checks I turned off the fit image step

  • Creating Thumbnail from an Image with transparent background

    Hello,
    I want to create a thumbnail image of size 200 x 200 pixels from an image of any size.
    As the thumbnail is square, I'm centering the image according to size.
    The code I'm using is working fine BUT after centering and resizing original image
    and writing it to output file the remaining area is of black color.
    I want the background should be transparent.
    Code I'm using is not using JAI.
    Please suggest me the solution.
    the code I'm using is as follows:
    public static void makeThumbnail(String inFile, String thumbFile ) throws Exception {
    Image image = Toolkit.getDefaultToolkit().getImage(inFile);
    MediaTracker mediaTracker = new MediaTracker(new Container());
    mediaTracker.addImage(image, 0);
    mediaTracker.waitForID(0);
    int fixedHeight = 200 ;
    int fixedWidth = 200 ;
    int imageWidth = image.getWidth(null);
    int imageHeight = image.getHeight(null);
    double imageRatio = 0.25 ;     
    int thumbHeight = (int)(imageHeight * imageRatio );
    int thumbWidth = (int)(imageWidth * imageRatio );
    int x = ( fixedWidth - thumbWidth )/2 ;
    int y = ( fixedHeight - thumbHeight )/2 ;
    System.out.println(thumbHeight + " - " + y );
    System.out.println(thumbWidth + " - " + x );
    // draw original image to thumbnail image object and
    // scale it to the new size on-the-fly
    BufferedImage thumbImage = new BufferedImage(fixedWidth, fixedHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D graphics2D = thumbImage.createGraphics();
    graphics2D.setColor( new Color( 255, 255, 255, 0) );
    int rule = AlphaComposite.SRC_IN ;
    AlphaComposite ac = AlphaComposite.getInstance(rule, 0.9f);
    graphics2D.setComposite(ac);
    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    graphics2D.drawImage(image, x, y, thumbWidth, thumbHeight, null);
    // save thumbnail image to OUTFILE
    BufferedOutputStream out = new BufferedOutputStream(new    FileOutputStream(thumbFile));
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(thumbImage);
    int quality = 60 ;
    quality = Math.max(0, Math.min(quality, 100));
    param.setQuality((float)quality / 100.0f, false);
    encoder.setJPEGEncodeParam(param);
    encoder.encode(thumbImage);
    }

    Change this line
    BufferedImage thumbImage = new BufferedImage(fixedWidth, fixedHeight,
              BufferedImage.TYPE_INT_RGB);
    ...to use a BufferedImage type that supports transparency like TYPE_INT_ARGB or TYBE_4BYTE_ABGR (I would recommend the latter since your saving the image).
    Also, btw, you're not going to like the quality of the thumbnail if the image is reduced by more then half its size.

  • How can I create a black and white image similar to what I see in the "Replace Color" tool?

    Hi all, I'm just wondering how I can create a black and white image similar to what I see in the preview window of the "Replace Color" tool. See attached screenshot for clarification -- I need the grass to be black while the soil is white or vice versa. Any tips?

    One way is to use Select>Color Range
    Make a new Color Fill Layer>White
    (Layer>New Fill Layer>Solid Color)
    Put a new color fill layer below>black
    Just invert the layer mask on the top fill layer for the opposite effect.

  • Create thumbnail from selected images

    Hi,
    in my app the user can choose some pictures from his local
    file system.
    I want to create a smaller image of every selected picture.
    So I do this for each image:
    for( var f = 0; f < e.files.length; f++ ){
    name = e.files[f].name;
    src = e.files[f].url;
    path = e.files[f].parent.url;
    files.push( e.files[f] );
    //...some other code, not important for this...//
    image = new air.Loader();
    image.contentLoaderInfo.addEventListener(
    air.Event.COMPLETE, function() {
    var ratio = null;
    if (image.width <= 100) {
    thumb_height = image.height;
    thumb_width = image.width;
    ratio = 1;
    else {
    var thumb_width = 100;
    var thumb_height = null;
    var factor = image.width / thumb_width;
    thumb_height = Math.round(image.height / factor);
    ratio = 100/ image.width;
    if (thumb_height > thumb_width) {
    thumb_height = 120;
    factor = image.height / thumb_height;
    thumb_width = Math.round(image.width / factor);
    ratio = 100/ image.width;
    var bmp = new air.BitmapData( thumb_width, thumb_height );
    var temp = air.File.createTempFile();
    var desktop = null;
    var matrix = new air.Matrix();
    var png = null;
    var stream = new air.FileStream();
    var div = null;
    var elem = null;
    matrix.scale( ratio,ratio );
    bmp.draw( image.content, matrix );
    png = runtime.com.adobe.images.PNGEncoder.encode( bmp );
    stream.open( temp, air.FileMode.WRITE );
    stream.writeBytes( png, 0, 0 );
    stream.close();
    desktop = air.File.desktopDirectory.resolvePath( toPNG(
    e.files[f] ) );
    temp.moveTo( desktop, true );
    image.load( new air.URLRequest(e.files[f] ) );
    function toPNG( orig )
    return orig.name.substr( 0, orig.name.length -
    orig.extension.length ) + 'png';
    The problem is, that the "thumbnail" is only created of the
    last selected image. I think it has something to do with the
    air.Event.COMPLETE event. But when I kick that off, an error
    occures: Error #2015: Invalid BitmapData. at
    flash.display::BitmapData().
    Hope somebody can help. Thanks in advance

    Here´s a nice example that does exactly what I want:
    <html>
    <head>
    <title>Thumbnails</title>
    <script src="library.swf"
    type="application/x-shockwave-flash"></script>
    <script src="AIRAliases.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    var MAX_HEIGHT = 100;
    var MAX_WIDTH = 100;
    var files = null;
    var index = 0;
    var loader = null;
    var output = null;
    function loadImages()
    if( index < files.length )
    output = document.createElement( 'div' );
    loader.load( new air.URLRequest( files[index].url ) );
    } else {
    loader.visible = false;
    function doLoad()
    loader = new air.Loader();
    loader.contentLoaderInfo.addEventListener(
    air.Event.COMPLETE, doLoaderComplete );
    window.nativeWindow.stage.addChild( loader );
    btnOpen.addEventListener( 'click', doOpenClick );
    function doFilesSelect( e )
    files = e.files;
    index = 0;
    loadImages();
    function doLoaderComplete()
    var bmpd = null;
    var encoder = null;
    var img = null;
    var jpg = null;
    var matrix = null;
    var ratio = 0;
    var realHeight = loader.contentLoaderInfo.height;
    var realWidth = loader.contentLoaderInfo.width;
    var stream = null;
    var thumb = null;
    var thumbHeight = 0;
    var thumbWidth = 0;
    if( realWidth > 0 )
    if( realWidth <= MAX_WIDTH )
    thumbHeight = realHeight;
    thumbWidth = realWidth;
    ratio = 1;
    } else {
    thumbWidth = MAX_WIDTH;
    thumbHeight = 0;
    factor = realWidth / thumbWidth;
    thumbHeight = Math.round( realHeight / factor );
    ratio = MAX_WIDTH / realWidth;
    if( thumbHeight > thumbWidth )
    thumbHeight = MAX_HEIGHT;
    factor = realHeight / thumbHeight;
    thumbWidth = Math.round( realWidth / factor );
    ratio = MAX_WIDTH / realWidth;
    matrix = new air.Matrix();
    matrix.scale( ratio, ratio );
    bmpd = new air.BitmapData( thumbWidth, thumbHeight );
    bmpd.draw( loader, matrix );
    encoder = new runtime.com.adobe.images.JPGEncoder( 85 );
    jpg = encoder.encode( bmpd );
    thumb = air.File.desktopDirectory.resolvePath( 'thumb_' +
    files[index].name );
    stream = new air.FileStream();
    stream.open( thumb, air.FileMode.WRITE );
    stream.writeBytes( jpg, 0, 0 );
    stream.close();
    output.innerHTML = files[index].name + ': ' + realWidth + '
    x ' + realHeight;
    document.body.appendChild( output );
    img = document.createElement( 'img' );
    img.src = thumb.url;
    output.appendChild( img );
    index = index + 1;
    loadImages();
    function doOpenClick()
    var browse = air.File.desktopDirectory;
    browse.addEventListener( air.FileListEvent.SELECT_MULTIPLE,
    doFilesSelect );
    browse.browseForOpenMultiple(
    'Select Images',
    [new air.FileFilter( 'Image Files',
    '*.gif;*.jpg;*.jpeg;*.png' )]
    </script>
    </head>
    <body onLoad="doLoad();">
    <input id="btnOpen" type="button" value="Open..." />
    </body>
    </html>

  • Creating photo thumbnails?

    I hate to use the "F" word, but in FrontPage I could use
    Ctrl-T to change a photo on a page to a thumbnail, and it created
    the link to the original.
    How do I do this in DW CS3? I did Commands/Create Web Photo
    Album, but that wants Fireworks. I can't afford to by FW now. Isn't
    there a simpler way other than manuall creating the Thumbnails and
    linking them to the originals?
    I hate that I may have lost a function I used often in FP.
    Gary

    "Joris van Lier" <[email protected]> wrote:
    >>"Clancy" <[email protected]> wrote
    >> PHP has very good functions for manipulating photos,
    including producing
    >> thumbnails,
    >
    >Please do preferably with code examples that we can turn
    into
    >ServerBehaviors :)
    The image manipulation facilities are a bit slow (6-10
    seconds per set of 3
    images), so I only use them to set up the working images on
    my own PC, before I
    upload them. I haven't tried running them on the remote
    server. $quality is a
    constant which determines the quality and degree of
    compression of the new
    image. 100 gives no compression, 80 gives a good-quality
    image of reasonable
    size, but anything much below 70 gives very obvious "ringing"
    on things like
    telegraph poles against a blue sky.
    I don't know about 'ServerBehaviors', so you'll have to work
    that out :)
    Notice that in my example procedure I reset the time limit
    for every new image.
    I normally set this to 1, so I don't wait foreverwhen I write
    the inevitable
    infinite loop, but this way I don't time out halfway through,
    but I don't wait
    for ever if I do write an infinite loop.
    These functions worked for me with php set up as instructed
    by David Powers in
    his book "PHP for Dreamweaver 8".
    To get the EXIF information function working I had to
    uncomment the lines:
    extension=php_mbstring.dll (already included)
    extension=php_exif.dll
    in the file php.ini
    A. Shrink image.
    <?php
    // Set up $orig_image as full path/file name of image to be
    reduced
    // eg Flowers/Orchids/Diuris/DSCN1055.JPG
    // 1. Create an image object (presumably a bit map?) from it.
    $wkg_image = imagecreatefromjpeg($orig_image); // Working
    copy of original
    image
    // 2. Get original size
    $size = getimagesize ($orig_image); // Get dimensions
    // 3. Decide new dimensions (the magic numbers used here are
    explained in the
    example below)
    $height = $scale[$k][0]; $width = (int) ($height*$ratio);
    // 4. Decide where to put target. Again full path/filename
    $target = $path.$image;
    // 5. Create a temporary image object the size of the new
    image.
    $temp_image = imagecreatetruecolor($width, $height);
    // 6. Resample the image into the new object (if you replace
    the zeroes with
    offsets you can specify a portion of the image to be sampled
    -- I haven't tried
    this)
    imagecopyresampled($temp_image, $wkg_image, 0, 0, 0, 0,
    $width, $height,
    $size[0], $size[1]);
    // 7. Convert it to JPEG
    imagejpeg($temp_image, $target, $quality);
    // 8. Discard the temporary images.
    imagedestroy($temp_image);
    imagedestroy($wkg_image);
    // Done!
    B. Procedure to list all EXIF (image header data). I'm not
    too sure how this
    works, but it does! (Comes from the manual.)
    // Specify source file
    $old_image = 'Dev/Original/DSCN0389.jpg';
    echo '<p>T:153. Trying to read data from
    '.$old_image.'</p>';
    $exif = exif_read_data($old_image, 0, true);
    echo "T:157 '.$old_image.':<br />\n";
    foreach ($exif as $key => $section)
    foreach ($section as $name => $val)
    echo "$key.$name: $val<br />\n";
    C. Actual procedure to scan directory, get updated files, and
    generate large,
    medium and thumbnail images meeting specific size
    constraints. (Large fits
    nicely on 1280*1024 screen, Medium on 1024*768 screen.)
    // (This is not written as a procedure, just included when
    needed. It is
    included purely to show you an actual working example using
    these functions)
    // 23/10/07 Created
    $get_img = array (false, false, false);//
    $changed = false;
    $quality = array (80, 80, 75);
    $img_dirs = array ( 'Large/', 'Images/', 'Thumbs/' );
    $pattern = ".jpg"; // I only want .JPG images
    // Apply different algorithms according to shape of image and
    required size.
    $limits = array (
    0 => array ( 1.05, 1.61 ), // Large image
    1 => array ( 1.0, 1.725 ), // Normal image
    2 => array ( 0.1, 1.125 )); // Thumb
    $scale = array (
    0 => array ( 830, 770, 1240), // Maximum dimensions
    (Height for portrait, then
    landscape, then width for superwide)
    1 => array ( 610, 550, 950),
    2 => array ( 160, 160, 180));
    // See which sizes have been requested.
    if (array_key_exists('ck_l', $_POST)) { $get_img[0] = true; }
    //echo
    '<p>Im_2_22: $get_img[0] = true</p>';}
    if (array_key_exists('ck_m', $_POST)) { $get_img[1] = true; }
    //echo
    '<p>Im_2_23: $get_img[1] = true</p>'; }
    if (array_key_exists('ck_t', $_POST)) { $get_img[2] = true; }
    //echo
    '<p>Im_2_24: $get_img[2] = true</p>'; }
    // Abandon if 'Cancel' set.
    if (array_key_exists('cancel', $_POST))
    $edit_data['action'] = 0; $edit_data['ind_act'] = 0;
    $changed = 0;
    else
    $dir = $edit_data['f_path'].'Original';
    //echo ('<p>Im_2_34: Trying to open
    '.$dir.'</p>');
    f (is_dir($dir))
    if ($dh = opendir($dir))
    //echo "<p>Im_2_39: ".$dir." opened OK.</p>";
    while (($image = readdir ($dh)) !== false)
    $orig_image = $dir.'/'.$image;
    if (stristr ($orig_image, $pattern))
    //echo "<p>Im_2_46: Next image =
    ".$orig_image."</p>";
    $src_date = date ("ymdhis",filectime($orig_image)); // Get
    date file
    updated
    set_time_limit(4);
    // Got an image. K = 0 (large), 1 (normal), 2 (thumb)
    // See if already present, and later version
    $wanted = false;
    $k = 0; while (($k < 3) && (!$wanted))
    $w[$i] = false;
    if ($get_img[$k]) // Want this size?
    $target = $edit_data['f_path'].$img_dirs[$k].$image;
    if ((!file_exists($target) || (date
    ("ymdhis",filectime($target))
    <= $src_date)))
    $wanted = true; $w[$k] = true;
    $k++;
    if ($wanted)
    $wkg_image = imagecreatefromjpeg($orig_image); // Working
    copy of
    original image
    $size = getimagesize ($orig_image); // Get dimensions
    $ratio = $size[0]/$size[1]; // Calc ratio of width to height
    echo '<p>Im_2_72: Size = '.$size[0].', '.$size[1].',
    '.$ratio.'</p>';
    $k = 0; while ($k < 3)
    if ($w[$k]) // Want this size?
    if ($ratio > $limits[$k][0])
    if ($ratio > $limits[$k][1])
    $width = $scale[$k][2]; $height = (int) ($width/$ratio);
    else
    $height = $scale[$k][1]; $width = (int) ($height*$ratio);
    else
    $height = $scale[$k][0]; $width = (int) ($height*$ratio);
    $target = $edit_data['f_path'].$img_dirs[$k].$image;
    echo '<p>Im_2_76: $k = '.$k.', Width = '.$width.',
    Height = '.$height.', orig:
    '.$size[0].' * '.$size[1].', Target = '.$target.'</p>';
    $temp_image = imagecreatetruecolor($width, $height);
    imagecopyresampled($temp_image, $wkg_image, 0, 0, 0, 0,
    $width, $height,
    $size[0], $size[1]);
    imagejpeg($temp_image, $target, $quality[$k]);
    imagedestroy($temp_image);
    $k++;
    imagedestroy($wkg_image);
    $changed = 1; // Magic numbers for my program
    $edit_data['action'] = 0; // Flag file written correctly
    $edit_data['ind_act'] = 2; // Generate index logical next
    step
    ?>
    Clancy

  • Is it possible to add a thumbnail to an image file with core graphics ?

    Hi,
    I'm writing a small image processing application.
    For image reading and writing I'm using core graphics (CGImageSourceRef / CGImageDestinationRef).
    Several image formats like jpeg or tiff provide the option to store a thumbnail in the file.
    To get this thumbnail I'm using
    CGImageSourceCreateThumbnailAtIndex( ... )
    which works fine so far. If there is no thumbnail in the image it is created
    with this function. Now, in the case there was no thumbnail in the image I would like to store
    the created thumbnail in the image file when I write it to the disk. So far I failed to find a function in core graphics
    to perform this task. In the CGImageDestinationRef documention it is only mentioned, that thumbnails
    are written into the output file, but not how to add these.
    I fear I'm overseeing something very trivial ...
    Regards,
    ingo

    normfb wrote:
    I believe that a Smart Object will solve your problem.
    place your original image in a new file as a smart object and do the same for the reflection (made by Transforming, reducing the opacity and introducing a mild horizontal motion blur) on its own layer, then:
    by double clicking on the smart object in the layers panel and returning to the original image, any change you make in the original and save, will automatically update the upright image and its reflection.
    Nice one Norm.  Five Kudos points to you.

  • IMovie won't replace existing images in Project with new ones?

    I have created a project which contains still images.  When I select "replace" with a new image, no change occurs or the thumbnail shows an image which was inserted earlier.  "Insert" nothing.  It worked prior to the latest "updates" installed on my MacBook Pro.  Why doesn't this work!   Going CRAZY!

    Hi,
    This is a known behaviour. When you publish the new version of the workflow, the previous version is still available because there might be some workflows executing in lists and libraries on this version. But you can remove the previous versions so that
    they are not available for the users to starts. Go to List/Library > Settings > Workflow Settings.
    You will see all the previously published versions of the workflow. Here it shows the version of the workflows with Allow, No New Instance or Remove options. By default, previous version workflow should change to "No new instance" so users cannot
    start this manually. If this does not happen then this workflow will be available for users to start as in your case. If no instances of previous version are running, then select remove, and click Ok. Hope it clarifies.
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • How to replace original photos?

    I am helping my mom set up her iPad. We bought her a used one, generation 1 with ios 5. Every photo editor we have tried saves edited photos as a new photo. It's making tons of copies of photos that she just doesn't need. Even a simple edit, like rotate, makes a new photo.
    Is there a way to change the settings in Photoshop Express so that the edits replace the original? For non-photographers who don't care about retaining the pristine original copy (which probably isn't that great in the first place), this would be an ideal option.
    If Photoshop Express can't do this, can anyone recommend an app that does?
    Thanks so much,
    Angie

    Photoshop express always creates a new copy of the edited photograph in order to preserve the original image. Also we do not provide a setting to do so.
    Thanks,
    shuchi

  • Help needed trying make thumbnails from large Image Files

    I posted this to the Flex message bored, too. I didn't notice
    the Actionscript 3.0 until after. Sorry. Anyway, I have some
    ActionScript 3.0 code, created with Flex that will load a large
    JPEG image (say 3000x2000 pixels) that I'm trying to create a 100
    pixel thumbnail. I have the code working where I generate the
    thumbnail, but it's not maintaining the aspect ratio of the
    original image. It's making it square, filling in white for the
    part that doesn't fit.
    I've tried just setting the height or width of the new
    image, but that doesnt render well, either.
    To see what I'm talking about, I made a screen shot, showing
    the before image, and the rendered as thumbnail image:
    Image of demo
    app at Flickr.
    Now, there's a few things important to note. I'm saving the
    thumbnail off as a JPEG. As you can see in my sample application,
    the original renders fine with the proper aspect ratio, it's when
    I'm copying the bytes off the bitmapdata object, where I need to
    specify a width and height, that the trouble starts. I've also
    tried using .contentHeight and .contentWidth and some division to
    manually specify a new bitmapdatasize, but these values seem to
    always have NaN.
    private function makeThumbnail():void{
    // create a thumbnail of 100x100 pixels of a large file
    // What I want to create is a a thumbnail with the longest
    size of the aspect
    // ratio to be 100 pixels.
    var img:Image = new Image();
    //Add this event listener because we cant copy the
    BitmapData from an
    /// image until it is loaded.
    img.addEventListener(FlexEvent.UPDATE_COMPLETE,
    imageLoaded);
    img.width=100;
    img.height=100;
    img.scaleContent=true;
    img.visible = true;
    // This is the image we want to make a thumbnail of.
    img.load("file:///C:/T5.jpg");
    img.id = "testImage";
    this.addChildAt(img, 0);
    private function imageLoaded(event:Event):void
    // Grab the bitmap image from the Input Image and
    var bmd:BitmapData =
    getBitmapDataFromUIComponent(UIComponent(event.target));
    //Render the new thumbnail in the UI to see what it looks
    theImage.source = new Bitmap(bmd); //new Bitmap(bmd);
    public static function
    getBitmapDataFromUIComponent(component:UIComponent):BitmapData
    var bmd:BitmapData = new
    BitmapData(component.width,component.height );
    bmd.draw(component);
    return bmd;
    }

    Hi Tod,
    Take a look at this post:
    I'll have to say the smoothing of the thumb is not perfect, but maybe in combination with your code.. you get good results.
    Post a solution if you acheive better smooth thumb results.
    Link to forum post:http://forums.adobe.com/message/260127#260127
    Greets, Jacob

  • Replace new image into existing project

    I need to replace a image that I used in a transition. This image will fly in from the side from my start page to my main page.
    I originally made everything the way I wanted then duplicated the state then I moved the items to be flown on to the page or faded into the page etc...
    but now the new imported image is only on one state. if I copy the image from the main state and paste the image to the start state and try to make a transition the image only gets a fade in selection in the timeline. Even if I move the image it will still only fade in. I want the image to fly in from the side.
    I think what is happening is that the image is no longer "Linked" between states so it does not know where the graphic starts and where it should end.
    It thinks its 2 different graphics. Is their a better way than to copy and paste state to state to be able to keep the association and create a transition?
    Otherwise I have to redo hours of work just to replace an image ?????
    Please help....

    Hi Curtis,
    Transitions are between the same item (or "instance" to be fancy) when it has different properties (like position, size, opacity, rotation,etc) in different states. When you import an image, you create a new item in the Art Board. If you copy-paste, you create another item.
    If you want the same item to show up in multiple states, right click it and choose "Share to State" and the state you want it to appear in.
    There's also a "Make same in All States" that makes an item have the same appearance in all states that it's present in.
    For your specific case, though, you have transitions already working on an image, so you should just change the image to have a new source. Click the image that had been working before, click the "source" in the Properties Inspector (lower right), and you should have the ability to change where your image is coming from.
    -Bear

  • Script for making random thumbnails from single image

    Hi all,
    I need something like a hundred different thumbnails from each image in a series of images, that is, hundred random sections of the same image, saved in a folder as jpg,  and i was hoping that i could find a script for this.
    What the script has to do is:
    select the size of the crop (this would also be the dimensions of the thumbnail saved)
    rotate crop selection in a random orientation and place the crop randomly on the canvas
    save the image as a jpg in a folder
    return to original image,
    repeat process x times before quitting script.
    I dont think this should be to difficult to make a script for, but unfortunately i don´t know how to code.
    Is there anybody that could help me with this?
    This would save me a lot of time!

    You can give this a try:
    // create copies with pseudo random clipped and rotated parts of image;
    // thanks to xbytor;
    // 2012, use at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.POINTS;
    // set name for folder to save jpgs to;
    var folderName = "rotatedJpgs";
    // set number of jpgs;
    var theNumber = 100;
    // width and height;
    var theWidth = 500;
    var theHeight = 500;
    // calculate some values;
    var theDiagonal = Math.sqrt ((theWidth * theWidth) + (theHeight * theHeight));
    var diagAngle = angleFromRadians(Math.acos((theWidth) / (theDiagonal)));
    // get file name and path;
    var myDocument = app.activeDocument;
    var docName = myDocument.name;
    try {
              var basename = docName.match(/(.*)\.[^\.]+$/)[1];
              var docPath = myDocument.path;
    catch (e) {
              basename = docName;
              var docPath = "~/Desktop";
    // create folder if it does not exist yet;
    if (Folder(docPath + "/" + folderName).exists == true) {
              var docPath = docPath + "/" + folderName;
    else {
              var theFolder = Folder(docPath + "/" + folderName).create();
              var docPath = docPath + "/" + folderName;
    // document dimensions;
    var docWidth = myDocument.width;
    var docHeight = myDocument.height;
    // jpg options;
    var jpegOptions = new JPEGSaveOptions();
    jpegOptions.quality = 10;
    jpegOptions.embedColorProfile = true;
    jpegOptions.matte = MatteType.NONE;
    // duplicate image;
    var theCopy = myDocument.duplicate (theCopy, true);
    var origResolution = theCopy.resolution;
    theCopy.resizeImage(undefined, undefined, 72, ResampleMethod.NONE);
    var docHalfWidth = theCopy.width / 2;
    var docHalfHeight = theCopy.height / 2;
    var theLayer = smartify2010(theCopy.layers[0]);
    theCopy.resizeCanvas (theWidth, theHeight, AnchorPosition.MIDDLECENTER);
    var theHistoryState = theCopy.activeHistoryState;
    // do the variations;
    for (var m = 0; m < theNumber; m++) {
    var theAngle = Math.random() * 360;
    theLayer.rotate (theAngle, AnchorPosition.MIDDLECENTER);
    //theCopy.resizeCanvas (theWidth, theHeight, AnchorPosition.MIDDLECENTER);
    // get tolerance offset;
    var theHor1 = Math.abs(Math.cos(radiansOf(theAngle + diagAngle)) * theDiagonal / 2);
    var theVer1 = Math.abs(Math.sin(radiansOf(theAngle + diagAngle)) * theDiagonal/ 2);
    var theHor2 = Math.abs(Math.cos(radiansOf(theAngle - diagAngle)) * theDiagonal / 2);
    var theVer2 = Math.abs(Math.sin(radiansOf(theAngle - diagAngle)) * theDiagonal / -2);
    // calculate max offset for unrotated overall rectangle;
    var thisHalfWidth = docHalfWidth - Math.max(theHor1, theHor2);
    var thisHalfHeight = docHalfHeight - Math.max(theVer1, theVer2);
    // calculate random offset for unrotated overall rectangle;
    var randomX = thisHalfWidth * (Math.random() - 0.5) * 2;
    var randomY = thisHalfHeight * (Math.random() - 0.5) * 2;
    var aDiag = Math.sqrt (randomX * randomX + randomY * randomY);
    var anAngle = angleFromRadians(Math.asin((randomY) / (aDiag))) + theAngle;
    anAngle = anAngle + Math.floor(Math.random() * 2) * 180;
    // calculate  offset for rotated overall rectangle;
    var offsetX = Math.cos(radiansOf(anAngle)) * aDiag;
    var offsetY = Math.sin(radiansOf(anAngle)) * aDiag;
    //alert (theAngle+"\n\n"+offsetX +"\n"+ offsetY+"\n\n"+ thisHalfWidth+"\n"+thisHalfHeight);
    theLayer.translate(offsetX, offsetY);
    theCopy.resizeImage(undefined, undefined, origResolution, ResampleMethod.NONE);
    theCopy.saveAs((new File(docPath+"/"+basename+"_"+bufferNumberWithZeros(m+1, 3)+".jpg")),jpegOptions,true);
    theCopy.activeHistoryState = theHistoryState;
    // clean up;
    theCopy.close(SaveOptions.DONOTSAVECHANGES);
    app.preferences.rulerUnits = originalRulerUnits;
    ////// radians //////
    function radiansOf (theAngle) {
              return theAngle * Math.PI / 180
    ////// radians //////
    function angleFromRadians (theRad) {
              return theRad / Math.PI * 180
    ////// buffer number with zeros //////
    function bufferNumberWithZeros (number, places) {
              var theNumberString = String(number);
              for (var o = 0; o < (places - String(number).length); o++) {
                        theNumberString = String("0" + theNumberString)
              return theNumberString
    ////// function to smartify if not //////
    function smartify2010 (theLayer) {
    // make layers smart objects if they are not already;
              app.activeDocument.activeLayer = theLayer;
    // process pixel-layers and groups;
          if (theLayer.kind == "LayerKind.GRADIENTFILL" || theLayer.kind == "LayerKind.LAYER3D" || theLayer.kind == "LayerKind.NORMAL" ||
          theLayer.kind == "LayerKind.PATTERNFILL" || theLayer.kind == "LayerKind.SOLIDFILL" ||
          theLayer.kind == "LayerKind.TEXT" || theLayer.kind == "LayerKind.VIDEO" || theLayer.typename == "LayerSet") {
                        var id557 = charIDToTypeID( "slct" );
                        var desc108 = new ActionDescriptor();
                        var id558 = charIDToTypeID( "null" );
                        var ref77 = new ActionReference();
                        var id559 = charIDToTypeID( "Mn  " );
                        var id560 = charIDToTypeID( "MnIt" );
                        var id561 = stringIDToTypeID( "newPlacedLayer" );
                        ref77.putEnumerated( id559, id560, id561 );
                        desc108.putReference( id558, ref77 );
                        executeAction( id557, desc108, DialogModes.NO )
                        return app.activeDocument.activeLayer
              if (theLayer.kind == LayerKind.SMARTOBJECT || theLayer.kind == "LayerKind.VIDEO") {return theLayer};
    ////// get an angle, 3:00 being 0˚, 6:00 90˚, etc. //////
    function getAngle (pointOne, pointTwo) {
    // calculate the triangle sides;
              var width = pointTwo[0] - pointOne[0];
              var height = pointTwo[1] - pointOne[1];
              var sideC = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
    // calculate the angles;
              if (width+width > width) {theAngle = Math.asin(height / sideC) * 360 / 2 / Math.PI}
              else {theAngle = 180 - (Math.asin(height / sideC) * 360 / 2 / Math.PI)};
              if (theAngle < 0) {theAngle = (360 + theAngle)};
              return theAngle

  • Create pdf with link to image library on shared server?

    I want to create a pdf from an image library that's shared across a server by 20 mac users.
    But I want the 'contact sheet' to include clickable links from the thumbnails within it, eg:
    the user can double click and image and it will open in photoshop.
    I've tried a few things via Acrobat pro and Bridge but nothing seems to match what I want.
    Can anyone suggest anything?
    cheers.

    I want to create a pdf from an image library that's shared across a server by 20 mac users.
    But I want the 'contact sheet' to include clickable links from the thumbnails within it, eg:
    the user can double click and image and it will open in photoshop.
    I've tried a few things via Acrobat pro and Bridge but nothing seems to match what I want.
    Can anyone suggest anything?
    cheers.

  • Photoshop CC: Have a template that I moved image into.  Image is too small.  How do I resize the image while in the template?  Or must I go to original image file and resize there again and again until I get the right fit?

    I have a template that I am able to plug different pictures into at different times.  The problem is that when I plug an image into that template, I find that the image is either too big or too small.  Is there a way to plug the image into the template and resize the image (and not the template itself) OR will I have to go to the file with the original image and resize it there and then try to plug it in to the template to see if it fits------and if it does not fit, go back to the original file with the image and resize it again and see if that fits---and so on and so on...........?  I have tried the" image size" option but it's hit or miss------mostly miss!
    Thanks!

    Read up on Smart Objects. It looks like you have no idea as to how to create and use them.
    Jut create a Smart Object from the layer containing whatever it image it is that you are "plugging into your template".  But you do need to learn the application at its most basic levels.
    Photoshop is a professional level application that makes no apologies for its very long and steep learning curve.  You cannot learn Photoshop in a forum, one question at a time.
    Or is it possible that you don't even have Photoshop proper but the stripped-down Photoshop Elements?"
    If the latter is the case, you're in the wrong forum.  This is not the Elements forum.
    Here's the link to the forum you would want if you're working in Elements.:
    https://forums.adobe.com/community/photoshop_elements/content
    If you do have Photoshop proper, please provide the exact version number of that application and of your OS.
    (edited for clarification)

Maybe you are looking for

  • Error while saving Prod order - "Class for order classification"

    Hi all I am getting the following error while saving the Production Order - "Class for order classification has not been generated". I went into the custiomization settings and tried to generate the class. But I get another error "No batch input data

  • "UFL 'u2ltdate' that implements this function is missing."

    I am working through migrating older reports from a very outdated version of Crystal into a newer version and trialing Crystal Server 2013 with Crystal Reports for Enterprise.  The only problem I am running into is that I have many reports using the

  • SB Audigy 2ZS distorted so

    I upgraded my SB Li've card with the SB Audigy 2ZS and noticed that while listening to songs and playing games, the sound is distorted. It sounds like the music is playing at a high speed and breaking in short intervals. I have upgraded the drivers w

  • Ipod and the mini

    do these use different versions of itunes. I just got a new 30gb video ipod and I still have my mini, will i be able to use them both on the same computer and itunes? or will i need to put itunes on my computer twice or what. or is there any better s

  • Same product id

    How do I make sure that when I create a Universal App to replace a Windows Phone 7 app that the product ids align and people who have bought the WP7 version, get free access to the UA version(s) - both phone and Windows. John... the original Visio MV