Resizing image within Canvas with mouse ?

Hi,
I am developing a paint program. In this I want to use selection tool as like microsoft paint. That select an area. and then resize it. Firstly i want to know about is how to select a particular area within canvas. and after selection can i resize it with mouse. Please help me.
Thanks in advance.
Manveer

Manveer-Singh wrote:
Hi,
I am developing a paint program. In this I want to use selection tool as like microsoft paint. That select an area. and then resize it. Search google for my Resizeable class. This will only work on Components, but you could build a component that as it resizes, it resizes the image.
Firstly i want to know about is how to select a particular area within canvas. and after selection can i resize it with mouse. Please help me. You may want to search google to see if you can find my MouseDragOutliner class.
keywords include tjacobs and java :-)

Similar Messages

  • Resizing images within Mail not working in Snow Leopard

    Hi,
    I recently upgraded to Snow Leopard on both my desktop (iMAC Quad Core) and my MacBook Pro. I'm now experiencing an issue when I attach images within the Mail application.
    In the past, if I attached an image I could resize it by selecting the option at the lower right of the window and it would scale the image accordingly. Now if I select "large" it resizes the image as if I selected small. It's tiny, like 30KB. I tried it on both machines and I get the same thing.
    This was never an issue before upgrading to Snow Leopard. In the past if I selected "large" it would scale my image down to roughly 4X6 300dpi.
    Has anyone else found a fix for this issue?
    Thanks so much!
    Michael

    Hi Terence,
    thanks for your reply.
    But i have now a Problem!
    iPhoto 09 itself can send max. 10 pics in one mail. When i drag & drop more photos to mail as attachement, mail can´t resize photos with greater than 150dpi correctly.
    I have many photos greater than 150 dpi
    With new iPhoto 09 i can not send:
    1. more than 10 photos
    2. without "zipping"
    with mail i can send more than 10 photos at one time but i cant resize these images!
    Allso whe i use this way:
    http://discussions.apple.com/thread.jspa?threadID=2627690&tstart=0
    The only way to send more than 10 photos with resizing the images is:
    1. export these photos from iphoto to a folder with resizing function
    2. drag or attach these photos to a mail
    3. send mail
    4. delete the created folder with images
    5. empty trash
    iPhoto 8 can send many photos at one time including resizing and display the estimated size of mail (e.g. Megabytes).
    Taner

  • AppleScript to resize images and save with new name

    I want to make an apple script, which resizes all images of a folder regardless what kind of filetype.
    The source folder will change every day.
    With the script i want to choose a source Folder, resize all images and save the files with my jpeg options in the same folder, but with adding  „_ipad“ in the filename.
    I tried to edit an existing script from this forum, but in Photoshop 5.1 i get the error-message "This function is possibly not available in this Version" in line 18 "save in file newFileName as JPEG with options myOptions"
    How can i save the documents with new name in the existing folder?
    Thanks.
    This is the script i’m working with:
    set inputFolder to choose folder with prompt "Wähle einen Ordner:"
    --set destinationFolder to choose folder with prompt "Wähle einen Zielordner" as string
    tell application "Finder"
              set filesList to (files of entire contents of inputFolder) as alias list
    end tell
    tell application "Adobe Photoshop CS5.1"
              set UserPrefs to properties of settings
              set ruler units of settings to pixel units
              repeat with aFile in filesList
      open aFile showing dialogs never
                        set docRef to the current document
                        tell docRef
                                  set newFileName to my getBaseName(name)
      --resize image height 240 resolution 72 resample method bicubic sharper
      change mode to RGB
      resize image resolution 72
                                  set myOptions to {class:JPEG save options, embed color profile:true, quality:12, format options:progressive, scans:3}
      save in file newFileName as JPEG with options myOptions
                        end tell
      close the current document saving no
              end repeat
              set ruler units of settings to ruler units of UserPrefs
    end tell
    on getBaseName(fName)
              set baseName to fName
              repeat with idx from 1 to (length of fName)
                        if (item idx of fName = ".") then
                                  set baseName to (items 1 thru (idx - 1) of fName) as string
                                  exit repeat
                        end if
              end repeat
              return baseName
    end getBaseName

    This seems like a Photoshop error not an AppleScript one. Have you looked in the Photoshop dictionary to see if the command you are getting the error on exists and if it has those options?
    If all you want to do is resize image files and save the resized image file you might want to look at Automator. Specifically the Scale Image action under Photos.
    regards

  • How to resize image to flow with my theme?

    Hello there,
    I have a site (removed) and I think my logo does not flow with the rest of my theme.
    How can I resize the logo that is already uploaded to my site?
    Thanks

    Hello, could you rather post a screenshot, (Printscreen on a PC, switch to Photoshop, new document, paste, and save, then use the camera icon here to upload your image.)
    We are sorry, but we've seen too many users create posts making fake invite for critiques, just to bring traffic to their site, so we have to draw a line (nothing against you, or we don't mean that you are doing it) and remove all such links.

  • Help: Resizing images for Printing with CS3

    Hello All,
      Thus far, I've done most of my printing with my Epson 3800 on paper below 8.5 x 11 which was no problem.  Now I'd like to do some larger stuff like 13 x 19 and 17 x 25.  Image size is 3504 x 2336 psd. @ 360ppi. (workflow is RAW to Adobe RGB 16-bit 8.2MP)  I'd like to maintain the 360ppi resolution, but resize to say 12 x 18 or larger and then apply final sharpening. 
      My confusion is with the up-sizing steps themselves.  I've heard it's best to increase image x% over target image size via Bicubic(?) and then to reduce x% to target size using Bicubic sharpener(?) or something to that effect.  Can someone please walk me through the process so I can get the hang of it?  Thank you!
    Mike

    MJCarnegie wrote:I've heard it's best to increase image x% over target image size via Bicubic(?) and then to reduce x% to target size using Bicubic sharpener(?) or something to that effect.
    Sounds like one of those tales from an older technology.
    Just use the resampling method as recommended in the Image size dialog

  • Resizing images and canvas

    Help,
    For gallery sumbmissions, I need to resize my image to 1920 by 1920 pixels. In element 3 it was quite simple, but in elements 10 everything has changed. If I try to chang e the image size, it won't let me chang e the pixels, only the size in inches. Then, moving to the canvass and not changing the image size,when changing the canvass, the original image is cropped and I can't fined anyway to match the image size with the change in canvass.
    thanks.
    Charlie

    Turn on Resample Image and then you can change the pixel size.

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

  • Trying to create a surface  with multiple images with mouse events

    novice programmer (for a applet program)
    hi trying to create a surface i.e jpanel, canvas, that allows multiple images to be created.
    Each object is to contain a image(icon) and a name associated with that particular image. Then each image+label has a mouse event that allows the item to be dragged around the screen.
    I have tried creating own class that contains a image and string but I having problems.
    I know i can create a labels with icons but having major problems adding mouse events to allow each newly created label object to moved by the users mouse?
    if any one has any tips of how to acheive this it would be much appreciated. Thanks in advance.
    fraser.

    This should set you on the right track:- import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        public class DragTwoSquares extends JApplet implements MouseListener, MouseMotionListener {  
           int x1, y1;   // Coords of top-left corner of the red square.
           int x2, y2;   // Coords of top-left corner of the blue square.
           /* Some variables used during dragging */
           boolean dragging;      // Set to true when a drag is in progress.
           boolean dragRedSquare; // True if red square is being dragged, false                              //    if blue square is being dragged.                            
           int offsetX, offsetY;  // Offset of mouse-click coordinates from
                                  //   top-left corner of the square that was                           //   clicked.
           JPanel drawSurface;    // This is the panel on which the actual
                                  // drawing is done.  It is used as the
                                  // content pane of the applet.  It actually                      // belongs to an anonymous class which is
                                  // defined in place in the init() method.
            public void init() {
                 // Initialize the applet by putting the squares in a
                 // starting position and creating the drawing surface
                 // and installing it as the content pane of the applet.
              x1 = 10;  // Set up initial positions of the squares.
              y1 = 10;
              x2 = 50;
              y2 = 10;
              drawSurface = new JPanel() {
                        // This anonymous inner class defines the drawing
                        // surface for the applet.
                    public void paintComponent(Graphics g) {
                           // Draw the two squares and a black frame
                           // around the panel.
                       super.paintComponent(g);  // Fill with background color.
                       g.setColor(Color.red);
                       g.fillRect(x1, y1, 30, 30);
                       g.setColor(Color.blue);
                       g.fillRect(x2, y2, 30, 30);
                       g.setColor(Color.black);
                       g.drawRect(0,0,getSize().width-1,getSize().height-1);
              drawSurface.setBackground(Color.white);
              drawSurface.addMouseListener(this);
              drawSurface.addMouseMotionListener(this);
              setContentPane(drawSurface);
           } // end init();
           public void mousePressed(MouseEvent evt) {
                  // Respond when the user presses the mouse on the panel.
                  // Check which square the user clicked, if any, and start
                  // dragging that square.
              if (dragging)  // Exit if a drag is already in progress.
                 return;           
              int x = evt.getX();  // Location where user clicked.
              int y = evt.getY();        
              if (x >= x2 && x < x2+30 && y >= y2 && y < y2+30) {
                     // It's the blue square (which should be checked first,
                     // since it's in front of the red square.)
                 dragging = true;
                 dragRedSquare = false;
                 offsetX = x - x2;  // Distance from corner of square to (x,y).
                 offsetY = y - y2;
              else if (x >= x1 && x < x1+30 && y >= y1 && y < y1+30) {
                     // It's the red square.
                 dragging = true;
                 dragRedSquare = true;
                 offsetX = x - x1;  // Distance from corner of square to (x,y).
                 offsetY = y - y1;
           public void mouseReleased(MouseEvent evt) {
                  // Dragging stops when user releases the mouse button.
               dragging = false;
           public void mouseDragged(MouseEvent evt) {
                   // Respond when the user drags the mouse.  If a square is
                   // not being dragged, then exit. Otherwise, change the position
                   // of the square that is being dragged to match the position
                   // of the mouse.  Note that the corner of the square is placed
                   // in the same position with respect to the mouse that it had
                   // when the user started dragging it.
               if (dragging == false)
                 return;
               int x = evt.getX();
               int y = evt.getY();
               if (dragRedSquare) {  // Move the red square.
                  x1 = x - offsetX;
                  y1 = y - offsetY;
               else {   // Move the blue square.
                  x2 = x - offsetX;
                  y2 = y - offsetY;
               drawSurface.repaint();
           public void mouseMoved(MouseEvent evt) { }
           public void mouseClicked(MouseEvent evt) { }
           public void mouseEntered(MouseEvent evt) { }
           public void mouseExited(MouseEvent evt) { }  
        } // end class

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

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

  • Problem with getting resized image's bytes

    I've got a problem with getting correct bytes of a newly resized image. The flow is that I retrive an image from the filesystem. Due to the fact that it is large I resize it to a 50x50px thumbnail. I can display this thumbnail in #benchmark1 (see code below). Unfortunately something's wrong with my imageToBytes funtion which returns reasonably small size of image but is totally useless - I can't make an image of it anymore so at #benchmark2 the application either crashes or keeps freezing. I saved this byte array on my disk and tried to preview under Windows how does it look but I got a message "Preview unavailabe". I did some digging in the Internet and I supposed that it's because I don't use any jpg or png encoders to save the file. Actually I think that it's not the case, as the bytes returned from method imageToBytes look weird - I cannot even make a new image of them and display it without any saving in memory.
                                  byte[] bytes = FileHandler.readFile (
                                          FileHandler.PHOTOS_PATH, fileName);
                                  Image img2 = Image.createImage (bytes, 0, bytes.length);
                                  img2 = ImageHandler.getInstance ().resize (img2);
                                                    //#benchmark1
                                  bytes = ImageUtils.imageToBytes (img2);
                                  img2 = Image.createImage (bytes, 0, bytes.length);
                                                    //#benchmark2my imageToBytes function is as follows:
         public static byte[] imageToBytes (Image img)
              int[] imgRgbData = new int[img.getWidth () * img.getHeight ()];
              byte[] imageData = null;
              try
                   img.getRGB (imgRgbData, 0, img.getWidth (), 0, 0, img.getWidth (),
                           img.getHeight ());
              catch (Exception e)
              ByteArrayOutputStream baos = new ByteArrayOutputStream ();
              DataOutputStream dos = new DataOutputStream (baos);
              try
                   for (int i = 0; i < imgRgbData.length; i++)
                        dos.writeInt (imgRgbData);
                   imageData = baos.toByteArray ();
                   baos.close ();
                   dos.close ();
              catch (Exception e)
              return imageData;
    I've run totally out of any idea what's wrong, please help!
    Edited by: crawlie on Jul 17, 2010 6:21 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hey Crawlie,
    Please note that simply writing int values into ByteArrayOutputStream will not suffice. Please have a look at the following conversion from int pixel value into byte[4]:
    public static final byte[] intToByteArray(int value) {
            return new byte[] {
                    (byte)(value >>> 24),
                    (byte)(value >>> 16),
                    (byte)(value >>> 8),
                    (byte)value
    }Good Luck!
    Daniel

  • How to resize image with high quality

    I refer lot of examples in image resizing. But quality of resized image not good. pls can give me solution for that with code?

    I refer lot of examples in image resizing.Have you read [_this article_|http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html]?
    db

  • Pb displaying image in a canva with jpg format

    I have an applet that displays images in a canva by pushing buttons. It works very well with gif image but bad with jpg image.
    Coincidence or not ? I don't know.
    What I know that I use the same method painting jpg or gif image
    (first changing image name then calling mycanva.validate() and mycanva.repaint() and of course mycanva paint method contains g.drawimage(myimage,0,0,200,200,this) )
    With jpg image what happens is the image is not completly painted (sometime half painted, sometime less than half painted) and if I do reload the browser the image is very well displayed...
    has someone an idea ?
    many thanks

    try your app on another computer and see if it does the same thing. I had a very similar problem and it turned out to be my video driver was not driving my video properly. I changed/updated the video driver and my problems were totally solved.

  • **Urgent**: GO_ITEM to pop-up CANVAS with IMAGE in Sun JRE gives error

    Our Forms 10g Environment is this: Forms [32 Bit] Version 10.1.2.0.2 (Production) using Sun JRE i.e. Java Plug-in 1.6.0_06
    Problem is that when we try to navigate to a canvas (from a Button) which has an IMAGE ITEM the form is exited. This happens in every form which has a canvas with an image.
    i.e. In Button, we have code: Go_Item('block123.button1'). Button1 is also in that pop-up canvas.
    Even GO_BLOCK gives the same result.
    If the image is in the same canvas as the button which has GO_ITEM code, then it works.
    Of course this whole things works fine in JInit. But we need to run in Sun JRE.
    Is this a Bug?? Any help would be greatly appreciated.

    christian erlinger wrote:
    Well, as you are on 10.1.2.0.2 I strongly suggest that you apply the latest Patchset (10.1.2.3) the latest CPU Patches and the latest merge Patches. A lot of focus related things are fixed in those patches.
    cheersI will do this and let u know thans.

  • I'm having trouble with my clone tool. When I am cloning it appears OK (the image within the brush circles is the correct colours) however once the cloning is done, it processes leaving me with a darkened blur. Any help with what's going on would be appre

    I'm having trouble with my clone tool. When I am cloning it appears OK (the image within the brush circles is the correct colours) however once the cloning is done, it processes leaving me with a darkened blur. Any help with what's going on would be appreciated.

    Which tool in Camera Raw, exactly? The Spot Removal Tool? Adjustment Brush?

  • Elements 10 canvas not working with tiff images; works fine with jpegs. What to do?

    Elements 10 canvas not working with tiff images; works fine with jpegs. What to do? It does not allow me to add a colored canvas, only a blank canvas.

    Perhaps some of the tiffs are already layers.
    In other words, since jpegs don't support layers, they all ways open with one locked background layer, but the tiff format does
    support layers so the tiffs don't have to have a locked background layer and can already be a regular layer that supports transparency.
    For the tiffs you could add a new color fill layer below and use the color you want the enlarged canvas to be.
    On pse 10 look at the bottom of the layers panel for the new adjustment of fill layer icon

Maybe you are looking for