Resizing an image in ActionScript

I'm working with a company on a project and we need a way to:
1). allow a user of our website to select an image on their
2). Compress that image to specific dimensions
3). Upload the image to the site.
We want to compress the image first to reduce upload time and
make sure the pictures fit nicely into the templates we

I would approach it this way
Flash/Flex to resize the image so user can see what is going
Then Flash/Flex can upload the resize data and the original
Then on the server side you would perform the resizing.

Similar Messages

  • Using Javascript & Actions to resize an image and add the filename as text

    I am currently working on a way to take an image, resize it and add exactly what is in it's file name (before extension) as a text layer. I have succeded in this BUT am having issues with file names that require more than one line of text.
    I need the text to align to the bottom of the image & the script or action must then resize the image so that the text does not overlap.
    Any ideas on how this can be done?
    At the moment I am using:
    -"Fit Image.jsx" to resize my image to a specific size (This was included in the Photoshop CS5 scripts)
    - A script to add the file name without extension and place the file name at a specific position.
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
      var docRef = activeDocument;
      // Now create a text layer at the front
      var myLayerRef = docRef.artLayers.add();
      myLayerRef.kind = LayerKind.TEXT; = "Filename";
      var myTextRef = myLayerRef.textItem;
      // strip the extension off
      var fileNameNoExtension =;
      fileNameNoExtension = fileNameNoExtension.split( "." );
      if ( fileNameNoExtension.length > 1 ) {
      fileNameNoExtension = fileNameNoExtension.join(".");
      myTextRef.contents = fileNameNoExtension;
      // off set the text to be in the middle
      myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
      myTextRef.size = 12;
            //set position of text
            myTextRef.justification = Justification.CENTER;
            myTextRef.kind = TextType.PARAGRAPHTEXT;
            myTextRef.width= docRef.width;
            myTextRef.height= docRef.height/ 2;
            myTextRef.position= [0, docRef.height * 0.88];
    catch( e )
      // An error occurred. Restore ruler units, then propagate the error back
      // to the user
      preferences.rulerUnits = originalRulerUnits;
      throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    alert( "You must have a document open to add the filename!" );
    Can the position be changed to allow more rows of text but keep it aligned with the bottom of the layer?
    How can I script in a way to make the image resize based on the amount of text lines?
    Any help would be greatly appreciated.

    You can add a text layer any where the only thing you need to worry about is the size of the font you use.  You can normally calculate a font size by saving the images resoltuion and then setting its resolution to 72 DPI calculate a font size basied of the images pixel width and the number of characters you want in a line. After adding the text layer you can restore the image to its original resolution and align the text layer by making a selection and alignint the text layer to the selection.  There are nine posibilites like the positions in the selection you can align to like a tick tack toe board. You need to use a script to add the text layer because your retrieving the filename.  The positioning of the text layer could be done easily in an action the would use the scriot to add a text layer the do a select all  the align the added text layer to the selection.
    About your script don't make text paragraph just add new line characters to make a multi line text layer So it can be positioned easily
    I do just that with my stampexif action.  The action uses my stampexif Photoshop java script to add a multi line text layer containing some formatted EXIF data then the action centers the text layer and add a layer style to it. Link Example

  • 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!

    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.:
    If you do have Photoshop proper, please provide the exact version number of that application and of your OS.
    (edited for clarification)

  • Help needed in Drag and Drop and  resizing of image icons

    Hi all,
    I'm doing a project on Drag and Drop and resizing of image icons.
    There is one DragContainer in which i have loaded the image icons and i want to drop these image icons on to the DropContainer.
    After Dropping these icons on to the DropContainer i need to resize them.
    I have used the Rectangle object in resizing.
    The problem now i'm facing is when i drag, drop and resize an image icon and when i try to drag, drop a second image icon the first image icon gets erased.
    can any one help me in fixing this error.
    if u want i can provide the source code.
    thanks in advance

    the major restrictions in its implemented only in

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

  • How do I resize an image in Photoshop CS2?

    Hi! I'm trying to resize an image in Photoshop Cs2 with OUT making it grainy or blurred. Please help!? I know there's some key you can hold down while dragging with the mouse but eh I forgot it! o_0 please help!

    If you have a vector version of the logo, the smartest thing is to resize it as vectors to the size you want, and
    rasterize it.
    Case in point:
    I was trying to make a 16px × 16px favicon for my blogspot site, and the only way I could get the details to appear nice and clean was to create the entire thing from shape layers, transform them all in one go to fit inside a 16px × 16px box I defined using guidelines, and THEN rasterize it using the Save For Web dialogue.

  • How do I resize an image in Lightroom?

    Hi everyone, was wondering if someone can help me as am trying to resize and image in lightroom and cannot find where to do it.. please help. thanks alexandra

    The Alamy upsizing is nonsense but you can actually use Lightroom export. You only have to use differnet numbers (presets) for different aspect ratios. These are the rough numbers for the aspect ratios I use:
    Assuming they want 16x2^20 (16.777.216) pixels rather than 16x10^6 (16.000.000) pixels, the image dimension to upsize with LR are the following:
    Aspect ratio 2:3 (portrait or landscape)
    ~ 5017 x 5017 pixels
    Aspect ratio 1:1 (square)
    ~ 4096 x 4096 pixels
    Aspect ratio 16:9 (portrait or landscape)
    ~ 5462 x 5462 pixels
    Aspect ratio 4:3 (portrait or landscape)
    ~ 4730 x 4730 pixels
    You can store those in presets, use sort to sort the images by aspect ratio and export one set after the other with different presets.

  • Automated Resizing of Images in Photoshop Elements 9

    I recently upgraded my wife's Photoshop Elements from version 6 to version 9.  However, there is one feature from version 6 that seems to not work in version 9.  When she drags an image into a blank template (of any size), the image drags in to the template in the full size.  So if the images are three times larger than the template, she has to resize every image after she drags them in which is a pain for her.  Previously in PSE6, when she dragged the image into the blank template, the program would automatically resize the image to fit within the window.  Then she could resize the iamge if she needed to.  It seems that there should be a setting for this, but I am coming up with nothing.  Anybody know of a solution to this?

    You didn't say if your on mac or windows, so you may not be familar
    with the elements organizer. The following workaround works on windows pse9,
    if your on a mac it may also.
    1. In the elements organizer, select (highlight) the photos you want to use.
        (don't open the photos into the elements editor, just select them)
    2. Back in the elements editor, with the project bin open, choose
       Show Files Selected in the Organizer.
    3. When you drag the photos from the project bin into your document, they should resize
       similar to pse6.
       If they are still to big, step back one step in the undo history panel from Transform the Frame to Place.

  • How can I resize an image in Preview?

    There has been lots of discussion about Preview but non really answers my question. If I resize an image and duplicate it the duplicate over rides the settings of the original - so now I have 2 images the same size which is not what I want. I want the new image smaller but to keep the original the same size as before resizing. Versions seem to do the same thing, and as far as I can make out so does export. I know you can revert one of the duplicate images to get it back to the original size but it is a rather convoluted process.
    I know there are very clever people here so perhaps one of you can give me a work flow to do what I require. Thanks in advance.

    Of course, you can save some steps by duplicating the original file first, and then resize the copy.

  • How do you resize a image/picture and save it?

    Hello, I know how to resize a image. But how do I save a new image/pictures has Jpeg with new size properties?

    Use File>Save As or File>Save for web. Either of these will create a new document as long as the name is different or is in another folder.

  • How do I resize an image within a drop zone (not the drop zone itself) in motion 5?

    How do I resize an image within a drop zone (not the drop zone itself) in motion 5?

    I think others would be able to help if you describe a little more why you'd like to do this. Given that drop zones are a way of passing images into Motion that you want to manipulate, resizing a drop zone is the equivalent of resizing the image.
    If you're having a problem with an image from Final Cut being too big or too small, select the Drop Zone in the inspector and make sure the Fit parameter is set to 'Fit' - 'Center' will result in images dropped not being scaled to fit the Drop Zone. 'Stretch' will force the dropped image to fill the space defined by the drop zone,
    If the image is already cropped and scaled up in Final Cut Pro, that is the information that Motion gets - you can't scale down the image to see more of the edges that have been cropped off.
    If you want more than one copy of the image passed via the drop zone, use Make Clone Layer from the Object menu.

  • Resized & resampled image problems in Elements 5.0 on xp

    I'm having trouble with resize & resample images (trying to make them much smaller) so I can place multiple images onto a PDFpage at predetermined individual specific physical sizes thereby avoiding resizing the images within the PDF document, of which I understand is a NoNo for getting it commercially printed.  When I resize & resample an image and set the physical dimensions of the image it prints as a test print to the size I have set/want. The problem arises after I have saved the image & then try to insert it into my document. The saved image file when inserted is still or very close to the same physical size as before I resized & resampled it. - So what am I not doing or doing wrong. I have checked the file size in Windows Explorer and the actual file size is only a fraction of what the original is. The image has been reduced from 3200KB to 109KB, confirming I have at least reduced something within the file, just not what I wanted to. When I reopen the file in Elements and print it it is still the size I want, so why isn't it the right size when I insert it into a document. I have read the help files and don't understand what I am doing wrong, Please help.

    I suspect that the resolution of the file is getting changed instead of dimensions. So, the file size is decreasing but the dimensions are remaining the same.
    Please confirm that you are resizing the image as follows:
    1. Open the image
    2. Go to Image -> Resize -> Image Size
    3. Select the option Resample Image
    4. Now provide the new dimensions in Width & Height
    5. Click OK and save the image
    Now try importing on the PDF page.

  • Problem with photoshop automatically resizing placed images

    I have PS6. I have images that are 144x100 px. When I use file>place ps resizes the image to 108x75. I can't figure out how to make ps quit resizing my pictures. Anybody know?

    When Pasting, Dragging, copying and placing an image Photoshop will copy all of the image being duplicated original pixels to preserve the image pixel quality the image quality.  If the receiving document has a different DPI resolution the image may look a different size in the  receiving documents because of the number of pixels added to the document that has a lower or higher dpi resolution.  If the image is being placed in if the image pixels exceeds the receiving documents canvas size. Photoshop may scale the smart object layer to fit within the canvas that depends on the users Photoshop's preference.  All of the images original pixels are still there in the embedded object.   In my Photoshop Collage Scripts  I always transform all placed images to 100% size  incase Photoshop scaled the placed image.  For you can not get the scale percent Photoshop used.  Once I know I have the image at 100% size I can use the layer bounds to get the actual number of pixels there are in the placed image.  Once I know that I can calculate the scale I need to use to resize the image to fit the area being populated in the collage template.   Once resized I center it into place and mask off any excess image pixels.

  • Resize html image in email signature

    Hi, I have been trying to insert my company logo in my email signature on Outlook Client 2013 but the results have been disappointing. Would greatly appreciate your assistance. Thank you in advance!
    My company logo is in png-format. Its dimensions are 1221 x 374 px, and has a dpi of192. Its size is 37.9 KB. 
    I have read from various online sources that it is better to resize the image such that it is not larger than 10 KB.
    However, I do not want to resize the image (to ideal width: 150 px) before inserting it in the signature editor, because doing that is bound to degrade the resolution of the image, no matter how good the photo editor is. I have tried gimp and various
    photo editors, but the resulting picture quality is poor and grainy. I can barely make out the text in the logo. 
    These are the 4 methods that I have tried:
    1. I followed this YouTube tutorial. I insert the image in signature editor. The location of the image is at my Desktop. Save and close. 
    I insert the signature in a new email. The resulting image is large and appears according to its original dimensions in my signature. So I resize the image in the inserted email signature, copy that resized image, then paste it in the signature
    editor. The resized image will appear, with reduced dimensions. I save and close the signature editor.
    Then, I insert the signature again in the email. The dimensions of the image are correct and they appear perfect. So I do a test by sending an email to myself. When I view the email on Outlook Client, the image looks perfect. However, on Outlook
    Web App, the image is extremely large and out of place. I have been racking my brains on how to solve this problem.
    2. Same as step 1. But instead of inserting the logo from my Desktop, I inserted the logo located on the web by typing its URL in full. I used: Insert > Link to File.
    However, the same problem appears. The image in the send email looks great on Outlook Client, but too large on Outlook Web App.
    3. Re-render the image to 96 dpi using IrfanView. I read from this source that Outlook will rescale any image that is not 96 dpi.
    Tried Step 1 again. But image size in Outlook Web App is too large again.
    4. I followed the steps in this link to create a HTML email signature. I used an online WYSIWYG HTML editor
    to generate the HTML code. I realised that altering the height and width of the image in the html changes the size of the image only in the WYSIWYG editor. I believe that Outlook Client overrides all provided image dimensions.
    Thank you so much for your help!

    Hi Joy,
    Try this.
    Compose the signature in Outlook, insert the original image, resize it to the correct size, by dragging the image using mouse.
    Compress using inbuilt Outlook tool, this should not degrade the quality of the image much.
    Click the picture or pictures that you want to change the resolution for.
    Under Picture Tools, on the Format tab, in the
    Adjust group, click Compress Pictures.
    If you do not see the Picture Tools and Format tabs, make sure that you selected a picture. You may have to double-click the picture to select it and open the
    Format tab.
    To change the resolution for the selected pictures only and not all of the pictures in the document, select the
    Apply only to this picture check box.
    Under Target output, click the resolution that you want.
    Now, copy all and create a new Signature out of this.
    Send out an email with this new signature and see if it works on OWA.
    Ensure you are checking it on the same PC and the Web browser is on 100% zoom level.
    In my case its appearing slightly smaller on Browser then on PC. Check if its same on different PCs as well.
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • Resize Multiple Images Simultaneously?

    Someone told me that in an Adobe product (not sure if its PS) there is a way to resize several image files simultaneously to the same size. I cannot find a way to do this. Has anyone done this before or does anyone know how to?

    chavite wrote:
    Im Sorry! I have CS4.
    Do any of the following
    Choose File > Scripts > Image Processor (Photoshop)
    Choose Tools > Photoshop > Image Processor (Bridge)
    Its use is is fairly self-explanatory but help tells all!

Maybe you are looking for

  • Color correcting - broadcast warning.

    what does the yellow exclamation mark on broadcast safe mean. Have been reading Ken stons CC tutorials and have been working to make my whites hit the 100 mark in my waveform. If it goes over 100 the warning lines turn red - obviously illegal - but a

  • OnSessionEnd delete username from applicationlist

    Hi everyone, I need some help with the OnSessionEnd function within my Application.cfc, let me explain: When users log in to the website their username gets stored in an application list 'users' (so I can show the users currently online on the websit

  • SQL query won't compile based on DB role privileges

    Can someone give me an explanation why the SQL query in a report won't compile if an object is owned by another schema and the parsing schema is given privileges to the table via a role grant? Or to phrase it another way, why do we have to make direc

  • Hash strength used in digital signatures

    Where in the configuration of the digital signatures do we specify what hash algorithm strength we wish to use?  I think the default is SHA-1, but where do I tell what is being used or required?  I know it's a pretty basic question, but it has me stu

  • Please explain what this program doing- I see the results but don't underst

    public class Mystery2{ public static void main(String []args){ int count = 1; while (count <= 10){ System.out.println(count % 2==1? "****":"++++++"); ++count; }//end while }//end main }//end class