How to fit image inside canvas Container?

Hi All,
I want to fit an image inside a canvas.
Making x and y to 0 of image is not working.
My problem is I am rotating image at 90 and I want to save that image. If i save normally it is not taking rotation.
So I am adding that image in a canvas and saving that canvas with rotated image.
Somehow some portion of canvas still remains empty after adding image to it.
Any idea how to perfectly fit image inside canvas?
Or How to rotate image bitmap data with maintainig aspect ratio?
Thank in advance

Mx component don't handle rotation very well.  Spark Group should handle it
better.
You may need to set the y to the height of the rotated image (its original
width).

Similar Messages

  • How to fit image in image control?

    I am using image control to display images.
    I have placed image control inside canvas.
    While loading I am maintaining image aspect ratio and based on it i am resizing image and canvas both.
    Now i have requirement that I dont want to change height and width of image and canvas control, instead image should be scalled to fit in canvas.
    I know image have scaleX, scaleY and scalecontent property.
    Can anybody guide me how to calculate scaleX and scaley so image fits in image control?
    Thanks,
    -CK

    did you try scaleContent="true"

  • Centering an image inside its container

    Hi,
    I have been placing several images with text on a web page on which I have been using CSS3 to float the images either left or right so that my text wraps around the image.
    Now, at the bottom of this same page, I want to add a wider image that I do not want to wrap text around.  I just want the image to centered on my page (or in its container I guess I should say, which is a div).
    If anyone could tell me the best way to do this, I would greatly appreciate it.
    Thanks in advance,
    Paul

    Thank you Ken,
    I created the .clearing rule as you suggested and added the <hr class="clearing" /> after the end of the paragraph that wraps around my second (and final) floated image.
    After the <hr class="clearing" />, I have my image reference for the image I want to be centered inside its containing DIV as follows....
    <hr class="clearing" />
    <p><img src="Images/pk_38_41_43.jpg" alt="Membrane Casting Line" width="612" height="367" class="center"/></p>
    ...the class="center" is a class I created where I set the left and right margins to "auto", hoping that this would do the job.  This didn't work.  My image appears all the way to the left.  If you can give me a hint what I should do to get it centered, I'd really appreciate it.
    Thanks again for your help,
    Paul

  • Fit image to canvas at load

    I have subclassed JPanel in order to make my own image canvas. I have implemented zooming in and out, and, since the images I'm going to be using are generally in the dimensions of 3000x2000, I'd like an image to fit to the space available when it's loaded. This would be done with zoomfactor=min(canvasw/imagew,canvash/imageh), but here's the catch: getWidth and getHeight return 0. Unless, as I soon learned from our friend Google, getWidth and getHeight are called in paintComponent. However, I need a zoomfactor to paint, and I need to paint in order to to obtain my zoomfactor. So I'm trapped, I guess. What do I do?
    On a side note, what's the deal with getWidth/Height? Can they only be called in paintComponent? And, why, although put in a JScrollPane, and drawing an image much larger than the open screen space, my widget doesn't scroll?

    Components don't have a size until the GUI is visible.
    I don't see the problem. I would suspect your paintComponent() method paints the image so the width and height are available at that time.
    Your application should set the zoom factor and then invoke repaint() to cause the panel to repaint the image.
    So at startup time you just set the zoom factor to minimum and the paintComponent() method should know how to interpret that value.

  • [Mac OSX / JS] How to find images inside sub folders using getFiles?

    Hi,
    My script uses the variable myFolder to store the path for the images Folder. But when I try to use myFolder.getFiles() to retrieve images that are in sub folders the script fails. The result is null. What can I do to force myFolder.getFiles() to search inside all sub folders?
    var myFolder = Folder().selectDlg("Select images Folder");
    var myFiles = myFolder.getFiles();
    I will appreciate any help.
    Thanks,
    Candido

    Hi John,
    Thanks for your help.
    I'm rushing to my work  so I don't have enough time to sort it out at the moment.
    If I understand you correctly, it should be something like so:
    var files;
    var folder = Folder.selectDialog( "Select a folder with images" );
    if (folder != null) {
         files = GetImages(folder);
         if (files.length > 0) {
              alert("Found " + files.length + " image files");
         else {
              alert("Found no image files");
    function GetImages(theFolder) {
         var imageFiles = [],
         fileList = theFolder.getFiles(),
         i, file;
         for (i = 0; i < fileList.length; i++) {
              file = fileList[i];
              if (file instanceof Folder){
                   GetImages(file);
              else if (file instanceof File && file.name.match(/\.(jpg|psd|tiff|pdf|eps)$/i)) {
                   imageFiles.push(file);
         return imageFiles;
    But it doesn't work.
    Regards,
    Kasyan

  • How to fit image file to exact table size on import?

    I am inserting image files (gif and jpeg) into spots in a pre-existing table.  When I do so the image file comes in way oversized and I have to resize the image to my original table block size.  Is there a method of inserting an image and specifying that I want it to fit to the size of the table cell beforehand?  Also, when I reduce the size of the image to the exact dimensions of an already existing table cell the size of the cell expands slightly and things are not lined up perfectly afterwards.  Am I supposed to make the image slightly smaller than the table cell to compensate for this?  Thanks for your time.

    Here is the code for the site I am just starting out with:
    Home
    I Googled PHP resizing but don't quite know where to put the code they have
    listed.  Does it go just before the table code?

  • How to fit image in oracle report

    HI,
    I have a report developed by report builder "oracle 10g".
    the report has an image and I read the path of the image on run time and draw it using a field.
    the problem is that the image not fit on the field area. and not stretched to the whole area of the field.
    I want to fit the image to the determined area.
    waiting your hand
    Edited by: user10745244 on Jun 19, 2010 10:00 AM

    Hi,
    If you set the Vertical Elasticity and Horizontal Elasticity to *Contract, then the full image will show.
    Hope this helps.
    Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • How to fit image to the screen of an Android device?

    Required to load the image from the gallery (CameraRoll) and fit to the screen entirely.
    Tried a lot of ways - completely unable to fit. Always cut off the edge of the image.

    You won't be able to write LabVIEW code that runs on the phone to return the data. What you would need to do is look to see if there is an Android App that can publish the data of the phone's internal sensors over TCP/UDP/bluetooth(?) and you can then write your LabVIEW VI to read that data using an appropriate method (e.g. TCP).
    I don't know of such an App - maybe you would have to write one which will be non-trivial. I tried a quick search of "sensor data tcp" and "sensor data" and there are some data loggers etc. for the phone sensors so maybe one of those will point you in the right direction.
    There is a little bit of information here http://stackoverflow.com/questions/18107148/real-time-wireless-sensor-data-transfer-wifi-or-bluetoot... and here http://onlinepresent.org/proceedings/vol4_2012/50.pdf
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • How to capture images from stageVideo container

    Hi,
    I am developing video conference application in flash with FMS4.5 and integrating StageVideo API for rendering video on hardware and it's working very nice but, I am not able to capture picture from StageVideo so If anybody have any idea/suggestions about capture picture from StageVideo then your suggestion will help more.
    Thanks
    Ram

    Hi,
    Thanks for your interest in StageVideo. The following resources might be useful:
    http://help.adobe.com/en_US/as3/dev/WSe9ecd9e6b89aefd2-68d5ef8f12cc8511f6c-8000.html
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageVideo. html
    http://everythingfla.com/quickies/stageVideo
    http://www.adobe.com/devnet/devices/articles/video_content_tv.html
    Thank you !

  • How do I position a Loader image inside a Sprite?

    In AS3 / CS4 I'm trying to programmatically create a bunch of rectangular objects, let's call them 'cards', that will contain an image and a colored background and eventually some other elements like text.  I want to create alot of these cards and move them around inside of a larger panel (also a Sprite) of sorts.  I can successfully create colored rectangles in my cards and place the cards where I want in the panel, but whenever I try to add an image to a card, I can't seem to position the image inside the card's coordinate space, it ends up being placed inside the larger panel's coordinate space instead, even though I'm adding the image/loader as a child of the card.  I thought maybe it had something to do with having to wait until the image loading was complete, so I added the listener as a test but that didn't work.  Here's the code:
                var cont:Sprite = new Sprite();  containing 'card'
                var rect:Sprite = new Sprite();  // draw a colored rectangle in the card
                var loader:Loader = new Loader();
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, positionLoader);
                rect.graphics.beginFill(0xbb3399);
                rect.graphics.drawRect(60,60,99,99);  // this works as expected
                rect.graphics.endFill();
                cont.addChild(rect);
                addChild(cont);
                var req:URLRequest = new URLRequest("top.png");
                loader.load(req);
                function positionLoader(e:Event):void {
                    loader.x = 30;  // position the image inside the containing card
                    loader.y = 30;
                    cont.addChild(loader);  // add the image to the card

    I solved this problem.

  • How to insert image in forms?

    Hi Friends,
    I m new to Forms. plz tell me how to display image in canvas (form)?
    I m using Forms 6i.

    do you want to show a static image or an image from the database?
    If its a static image have at look at this Re: Oracle FORMS with image background, is that possible?
    If its a database image you should have a table with a blob-column. If you use the databalock wizard and include that column in the block, it will generate you an image-item which can then be shown in the layout.
    Edited by: Andreas Weiden on 25.11.2008 21:58

  • Image inside font

    This tutorial shows how to place image inside font using layer mask http://www.photoshopessentials.com/basics/clipping-masks-and-type/
    Can someone suggest how to place  different image inside each letter?

    One way is to place each image on separate layer like normal then select a character and make it a selection, then apply that selection as a mask for that image layer.
    Another way is to select a character , make it a selection and then choose Edit>Paste into.
    To make a selection -
    Type out your text
    hold down ctrl or cmd key and click on the T icon in the text layer - this will make a selection for all the characters.
    hold down the alt or opt key and drag a negative selection around the characters you don't want
    You now have a selection for a single character, once you apply the above repeat these steps to select another character.
    Or
    You can use the text mask selection tools hidden in the text fly out. Using these tools will allow you to type out characters of a selection instead of live text.
    So you can type all to once and do all the steps above, or simply do one character at a time and save a bunch of repetitive wasted time.
    To access the hidden text tools move your mouse over the text tool in the left tool bar then press your mouse button down and wait a few seconds and the fly out will appear or if you happen to have a two button mouse you can simply right click on the tool for it to instantly appear.
    To recap the simplest method -
    Place your images
    Select one of the image layers
    Using the text mask tool type the first character
    Click the move tool (lowercase v) to get out the text tool and leave you with just a selection
    Layer>Layer Mask>Reveal selection or {click the icon at the bottom of the layers panel that looks like a circle inside of a square} This will convert the selection to a mask.
    Repeat for the rest of the characters.

  • A script to increase the minimum canvas size? (Like Fit Image, but with just my canvas)

    For starters to be clear, I'm looking to manipulate canvas size. Not image size.
    I want to create a script to automatically increase the width and height of my canvas in Photoshop to a specific size when necessary. I only want this to happen if my canvas is less than that specified size. For example: Let's say my canvas size is 300x250. I want the canvas to be at LEAST 600x600. If I run my action it will increase the canvas size to 600x600 for me. If I run this same script on an image where the canvas size is already 700x700, it won't do anything at all to it because both the width and height are equal to or greater than my target size.
    It would also need to work with the height and width on an individual basis. If my image is 400x800, the action would increase my width from 400 to 600, but it would leave the height of 800 alone. So the final canvas size will end up being 600x800.
    It's kind of like the "Fit Image" option in Photoshop, but I only want to manipulate my canvas size, NOT my image size.

    It is possible.
    But if you hope that the dialog remembers the last settings that would require storing those values (which could be done with a txt-file at some pre-defined location), but it would make the Script a bit more complicated.
    // resize canvas in either direction if it is below a defined minimum;
    // 2011; use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
    // dialog;
    var dlg = new Window("dialog", "increase width and height if under", [500,300,750,380]);
    // filter for checking if entry is numeric, thanks to xbytor;
    numberKeystrokeFilter = function() {
              if (this.text.match(/[^\-\.\d]/)) {
                        this.text = this.text.replace(/[^\d]/g, "")
              if (Number(this.text <= 0)) {this.text = 5};
              this.text = Math.round(Number(this.text));
    // fields for entry;
    dlg.hor = dlg.add("edittext", [14,15,88,35], "600", {multiline:false});
    dlg.hor.onChange = numberKeystrokeFilter;
    dlg.horText = dlg.add("statictext", [93,15,118,35], "px", {multiline:false});
    dlg.ver = dlg.add("edittext", [129,15,210,35], "600", {multiline:false});
    dlg.ver.onChange = numberKeystrokeFilter;
    dlg.verText = dlg.add("statictext", [215,15,240,35], "px", {multiline:false});
    dlg.hor.active = true;
    // ok- and cancel-button;
    dlg.buildBtn = dlg.add("button", [13,45,118,68], "OK", {name:"ok"});
    dlg.cancelBtn = dlg.add("button", [128,45,240,68], "Cancel", {name:"cancel"});
    // show dialog;
    dlg.center();
    // show dialog;
    var myReturn = dlg.show ();
    // proceed if ok-ed;
    if (myReturn == 1) {
    var myDocument = app.activeDocument;
    // set to pixels;
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    // set the minimum values;
    var minWidth = Number(dlg.hor.text);
    var minHeight = Number(dlg.ver.text);
    // get current ones;
    var theWidth = myDocument.width;
    var theHeight = myDocument.height;
    // resize canvas;
    myDocument.resizeCanvas(Math.max(minWidth, theWidth), Math.max(minHeight, theHeight), AnchorPosition.MIDDLECENTER);
    // reset;
    app.preferences.rulerUnits = originalRulerUnits;

  • How do i get a placed image to appear as image inside a layer?

    There is a long winded reason why I want this, but in essence I am trying to replicate another artwork that has been supplied to me.
    When I place a Photoshop image (TIFF / PSD etc) how can I get it so that it simply appears as <image> inside the relevant layer (screen shot attached)
    I am finding that when I place an image I do not get this

    That's what I had assumed. It just doesn't seem to be working for me. You don't think there is a Preference setting that might disable it?

  • How to fit to size to show the whole image in image display?

    HI, I am using a control palette to display my video images using image display. However, the size is alway out of proportion. How do i show the whole image in the small box screen size. Basically how to fit to size for the images? 
    Solved!
    Go to Solution.

    This should do the trick:
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

Maybe you are looking for