Script Photoshop crop resizes the Image, do not trim

Recently I tried to make a script that will find the center of the image and crop the desired width and height. I tried a few different things, but had no chance.

One thing I tried was settomg the limits to the full document

var bounds = [0,0,doc.width,doc.height];

And then I try cultures by size with no angle, but the image is reduced instead to be cropped.

doc.crop(bounds, undefined, desiredWidth, desiredHeight);

I tried something for the center of the file, then set the dimensions to the left by half the desired width, up to half of the desired height, right half of the desired direction with, then down to half the height desired to make the area and then crops.

var bounds = [(centerX-halfWidth),(centerY+halfHeight),(centerX+halfWidth),(centerY-halfHeight)]; 
doc
.crop(bounds);

When I try to, I get a warning that I don't have enough RAM. I didn't know if this is just due to the laptop, or because I'm a silly request.

Exactly how does the function of culture? And for the bounds property, do I have to pay the amount I want cropped by the dimensions here, or is it in the service of culture?

Any help or information would be greatly appreciated.

Limits up to left Bottrom right...  (x, y) if left up down right

var orig_ruler_units = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var dir = new Folder ('~/Desktop/Test');

var file = dir.getFiles ("*.jpg");

for (var i = 0; i)< files.length;="" i++)="">

var doc = app.open (files [i]);

var desiredWidth = 842;

var desiredHeight = 382;

Half-width var = (desiredWidth/2);

var halfHeight = (desiredHeight/2);

centerX var = (doc.width/2);

centerY var = (doc.height/2);

var limit = [(centerX-halfWidth),(centerY+halfHeight),(centerX+halfWidth),(centerY-halfHeight)];

var limit = [(centerX-halfWidth),(centerY-halfHeight), (centerX + halfWidth), (centerY + halfHeight)];

doc. Crop (Bounds);

var saveJPEG = new ExportOptionsSaveForWeb();

saveJPEG.optimized = true;

saveJPEG.quality = 50;

saveJPEG.format = SaveDocumentType.JPEG;

Path of folder for new photos

var jpegFolder = new Folder ("~/Desktop/Test2");

doc.exportDocument (jpegFolder, ExportType.SAVEFORWEB, saveJPEG);

doc. Close (SaveOptions.DONOTSAVECHANGES);

}

app.preferences.rulerUnits = orig_ruler_units;

Tags: Photoshop

Similar Questions

  • Photoshop CC: Have a template that I transferred the image to.  The image is too small.  How to resize the image in the template?  Or I have to go to the file original image and resize here over and over again until I have found the right person?

    I have a model I am able to plug different images at different times.  The problem is when I plug an image in this template, I think that the image is either too big or too small.  Is it possible to connect the image in the template and resize the image (and not the template itself) OR I have to go into the file with the original image and resize them it there and then try to plug it into the model to see if it fits - and if it does not fit, return to the original with the image file and resize it again and see if this fits - and so on and so on...?  "" I tried the "image size" option, but it's all or nothing - especially miss!

    Thank you!

    First, make sure that the original image is larger that you need. It is easier to delete pixels that so add nonexistent pixels.

    Place the image in the template.

    In the menu filters, choose Convert to smart object. (Make sure that the image layer is selected before doing this step)

    Now reduce the size of the image of what you need (ctrl-t or cmd - t) when satisfied click return/enter.

    Because the image layer is a smart object, you can replace the inner image in another image and the scale will remain the same. You will find the option to replace the image in the layers > smart menu object.

    If you need assistance more let us know.

  • Resize the image in the UI

    I was under the impression, this setting image.size = [X, Y] dimensionnera the image to size XY. But it turns out that it is cropped so that X / Y dimension. Why is this happening? Any way to resize the image and not crops?

    Thank you.

    There is a method described in the pdf of Peter Kahrel (scriptui-2 - 2.pdf), in paragraph image resizing.

    I hope this works also in the CP AE.

    Xavier.

  • Edit an image from lightroom to photoshop... Image does not open.

    When I want to edit an image from Lightroom to Photoshop (CC), Photoshop opens, but the image does not work. However, I am still able to do with some images, but some images are simply no opening. This is the time of fisrt I have this problem.


    My version of photoshop is CS5 extended.


    I have Lightroom 6.0.


    I'm with P.C.


    Thank you

    Photoshop Cs5 will not open images Nikon D750

    You must use the version of Photoshop cs6/CC or DNG converter to be able to view these images in Photoshop cs5 in DNG

    Download DNG Converter:-Adobe - Adobe Camera Raw and DNG Converter: for Windows: Adobe DNG Converter 9.2

    Concerning

    Assani

  • Cannot resize the image pasted on layer Photoshop CC 2015

    I just upgraded to CC 2015 and reloading of the older versions of almost all the programs.  In Photoshop CS6 I could stick an image on a layer and then take one of the corners to resize it.  There is nothing to grab to resize the image in 2015 CC.  Nothing!  How am I suppose to resize the image and play with it, unless I can grab the corners and shrink and enlarge?  Help!

    Edit > Transform > scale.

    Hold down the SHIFT key to keep the proportion

  • When I open Photoshop CS6, the image does not appear in Photoshop. The image IS open, i.e. the name of the file is displayed on a tab and the image layers appear in the layer panel. What is going on?

    Photoshop and Bridge is open as usual. But when I open an image, the image does not show in the area of the image. The image filename is show in a tab and the spectacle of layers in the Panel layer. What is happening and how to fix this.

    I solved the problem. It was somehow connected to my using Microsoft

    photos of theme. I put Windows to use the basic theme and the problem

    went. Thanks for the suggestions.

    HA!

  • Cannot resize the image.

    Hi, when I copy paste or open a new image in photoshop (cs6), I'm not able to find the arrows of resizing the image I used above. What should I do? Help, please. I clicked on the selectool tool, but I simply can't resize my image more.

    I think you can see the "controls turn Show" You Move tool settings...

  • Get the old value of font size of the text after resizing the image.

    Hi all

    I write the script to get the size of the font of the text layer. I'm old font size after resizing the image.

    Here are the steps:

    -I write the function to get the property of the selected text layer...

    getInfoOfText = function (textLayer)

    {

    ........;

    var textItem = textLayer.textItem;

    fontSize var = textItem.size;

    .........;

    }

    -After image resize 50%. I am executing this function.

    But I get always the old value of font size.

    Let's say that the size of the font of the text = 36 px.

    Now I apply Image resize 50%. Thus, the size of the font of the text becomes 18 px.

    Now, if I run the 'getInfoOfText' function, I get always 36 px.

    I can't understand the behavior. Am I missing something here? Is it possible to get the correct font size value?

    Please note that I use the CS6 version.

    Waiting for your help guys.

    Thank you

    It seems that there is a BUG in CS6 and CC with transformed text, here is a function of http://www.ps-bridge-scripts.talktalk.net/

    function getFontSize(){
    if(app.version.match(/^\d+/) < 13) return activeDocument.activeLayer.textItem.size;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
    var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('textKey'));
    var textSize =  desc.getList(stringIDToTypeID('textStyleRange')).getObjectValue(0).getObjectValue(stringIDToTypeID('textStyle')).getDouble (stringIDToTypeID('size'));
    if (desc.hasKey(stringIDToTypeID('transform'))) {
                var mFactor = desc.getObjectValue(stringIDToTypeID('transform')).getUnitDoubleValue (stringIDToTypeID('yy') );
        textSize = (textSize* mFactor).toFixed(2).toString().replace(/0+$/g,'').replace(/\.$/,'');
        }
    return textSize;
    };
    
  • IMAQ Vision: The image is not big enough for the operation (Imaq WriteToPNG.vi)

    Hi all

    I was stuck for a few days trying to get my work VI and get this error. It is as simple as to save a graph of intensity as an IMG, he works with JPEG formats but my graph is U16 grayscale and it is not supported by the jpeg format so I didn't get the expected results. Then I went to the PNG format and the error "the image is not big enough for that operation" appeared. I tried to resize as aid error NOR suggest, and got the same error, anyone has an idea on what could be the problem?

    Hello Bob,

    Thanks for the tips, I'll post my code in future issues (since I already solved this one). As you say, there was something wrong with my code, the code in the image actually worked well, but doesn't have the part where I wrote to the variable (the variable was not being written if its value is an array of 0x0, not big enough actually). Thank you!

  • Need an easy way to resize the image for the web program

    I used to use Picture manager to easily resize a large picture (1-2 MB) to use on the web (50-100 KB) program. Now upgraded to Windows 8 (Why oh why, it is so user unfriendly) and photo gallery only resizes the images to about 500 KB. How can I easily resize images effectively.

    I used to use Picture manager to easily resize a large picture (1-2 MB) to use on the web (50-100 KB) program. Now upgraded to Windows 8 (Why oh why, it is so user unfriendly) and photo gallery only resizes the images to about 500 KB. How can I easily resize images effectively.

    ======================================
    Perhaps the resizer freeware at the following image
    be worth a try.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Prish Image Resizer
    http://www.photo-freeware.NET/Prish-image-resizer.php
    (Operating system: Windows XP / Vista / 7 / 8)
    (the name of the 32-bit file is: 32bit_PrishResizer_2519.msi)
    (for 64 - bit file name is: 64bit_PrishResizer_2519.msi)

    (Note... the download links for 32-bit and 64-bit are reversed)

  • Resize the image sources - change the size of the images database

    Hi all

    I have a trivial problem, but I can't deal with it. I have a project with compositions called slides. Each slide have JPG image as layer and this image is assigned 100% to 106% Resize effect (two keyframes). The images have their own folder. I need to replace all the images but the problem is that the new images have different sizes, for the most part, they are bigger than originals. When I right-click the imported images directly on I don't see any options to change their size (single space reserved or solid). When I double click them to open it in a new tab I don't see no resizing tool and layer menu is grayed out for the most part.

    So far, I found that I have three possibilities:

    1. resize as a layer in the composition of each slider. Unfortuately I don't see any way to change the database size, so resize here means add another keyframe or change existing. If I change the first keyframe on the layer in the composition of the slide then I have to proportionally resize the last of them. There are about 20 slides this process would be quite painful

    2. resize the images before importing - with PSP, GIMP or same IrfanView. It would be a much better solution than before however, this means a blind resizing - without no preview as the composition. Whenever I want to change the size a bit, I have to import image again. Painful.

    3 convert the images to the compositions,

    Convert each JPG file in composition, put this composition as the layer to each composition drag next to layer JPG, transformation of copy of layer of JPG to the composition of the image layer and delete the JPG layer. Long process but the effect is exaclty as I want and the project is fairly durable for any other modification of the image. However, in larger projects where there are many effects assigned to layers, it would be very painful.

    So is there an easy way to change the sizes of the imported images database? I can't believe that in such a huge program like After Effects, there is no way for such a simple task. I believe firmly im just something missing.

    You can resize your layers in Ae with scale parameter. (transform-> scale). If there is no animation, you need not place a keyframe. for example, you can resize your layer to 46% and decide to evolve for a while, so the first keyframe will be 46%, and the last keyframe is 83%.

    Yes, I know that if you have layer with no keyframes for the scale property then scaling ways to change the size of its base. However, in my example, I have two frames - 100% and 106%. If I import large image so I have to resize. If im on the first keyframe, and then it wil change its size to 100% for example, 56%. But the last keyframe is not changed - its still 106%. So that means animation past from 56% to 106% - image develops much more quickly than in an original animation.

    But now I found that I can select all the points of the keyframe by clicking on the entire property scale and resize proportionally when I resize the image, all the points of the keyframe. It's the simplest and most effective solution for me!

    Thanks for the help!

  • I have some pretty high resolution still panoramas I want to move from left to right, but when I resize the image to fit the image, the resolution drops to an unacceptable level. Is this possible? John

    I have some pretty high resolution still panoramas I want to move from left to right, but when I resize the image to fit the image, the resolution drops to an unacceptable level. Is this possible? John

    Make sure that before you add this photo to your project, you go to the preferences (under the Edit on a PC) and uncheck the default scale to the size of the image.

    Scaling of artificially reduced image size your photo - no matter how large - the size of your video image, make detailed pans and zooms like your impossible. When it is not checked, your photo will be in full resolution and you will only see a small part of it in the preview window.

    That said, don't forget that you work at video resolution, so some details will be lost. (Less so, if you change video high-def). And, of course, don't forget to make your timeline after you have added your pans and zooms to see a better representation of what your final video will look like.

  • This script takes copies of the Image?

    RDBMS version: 11.2.0.3
    Platform: AIX 6.1

    Is the below mentioned the backup script taking copy of the image? What is the type of backup that is used in this script?
    recover copy of database with tag daily1 until time 'sysdate - 1';
    backup  incremental level 1 for recover of copy with tag daily1 database;
    backup as compressed backupset archivelog all not backed up;
    allocate channel for maintenance type disk;
    delete noprompt obsolete device type disk;
    release channel;
    -Another question on the above script
    If a data file is lost, would I be able to quickly restore, recover by using the following commands, if I use the above backup script?
    RMAN>sql ‘alter database datafile 7 offline’;
    RMAN>switch datafile 7 to copy;
    RMAN>recover datafile 7;
    RMAN>sql ‘alter database datafile 7 online’;

    This is the strategy of "Update backups gradually" what Oracle documents, but some of us are not comfortable with.

    See http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmbckba.htm#CHDEHBFF

    Why I'm not comfortable?
    (1) it causes the local backup on the database server - that is to say on the same SAN as the target database! (unless you connect two different San on database server)
    (2) it provides only 1 backup of the database to be available at any time (unless you do religiously the backups from this location on tape every day)
    (3) it offers the opportunity to move to the last backup, but not older backups (unless make you backups on tape and so make sure that you have backups of image on different days on different bands).

    It is too easy for a DBA / SA to not follow the three recommendations 'less' I added.

    Hemant K Collette

  • When I use Paste the Image to the Clipboard as stamp tool, I can't resize the image.

    Add a picture as a stamp of release in our .pdfs. Normally I can resize the image to fit what I need.  Sometimes, it works fine and I can resize the image.  Other times I can't.  I used "Ctrl-V" to paste.  I used paste the image to the Clipboard as stamp - and sometimes it works and sometimes it isn't.  I have not been able to find a consistency in when it neither does not let me resize.  Thank you!

    Resolution: Do not cross the Clipboard. This path does not support maintain them quality image files.

    You have a beautiful image that you like. Insert it into a Word file empty.
    Size and configure as desired by using the tools that Word provides. Record.
    Create a PDF file. With the help of Acrobat create a stamp that uses this PDF file. Record.

    Be well...

  • Resize the Image with the wheel causing exception 1502

    Description:

    I load an image inside a container of border and when I Zoom out, scroll bars disappear as expected. Now, when I resize the image to exceed the limits of the boarder container I get exception below. In my view, the exception is thrown when the scroll bars are reactivated but I could be wrong. Someone has seen this before

    Exception:

    Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
    at spark.components.supportClasses::ScrollBarBase/get viewport()
    at spark.components::VScrollBar/updateMaximumAndPageSize()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\VScrollBar.as:123]
    at spark.components::VScrollBar/http://www.adobe.com/2006/flex/mx/internal::viewportResizeHandler()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\VScrollBar.as:390]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12266]
    at mx.core::UIComponent/dispatchResizeEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9641]
    at mx.core::UIComponent/setActualSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9172]
    at spark.components::Group/setActualSize()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:891]
    at mx.core::LayoutElementUIComponentUtils$/setLayoutBoundsSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\LayoutElementUIComponentUtils.as:497]
    at mx.core::UIComponent/setLayoutBoundsSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:13069]
    at spark.components.supportClasses::ScrollerLayout/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\ScrollerLayout.as:546]
    at spark.components.supportClasses::GroupBase/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1224]
    at spark.components::Group/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:899]
    at spark.skins::SparkSkin/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\skins\SparkSkin.as:191]
    at mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8531]
    at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:663]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:736]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
    
    

    MXML code:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                      xmlns:s="library://ns.adobe.com/flex/spark" 
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:ns1="com.adobe.wheelerstreet.fig.panzoom.*"
                      pageTitle="FileNet Flex Viewer"
                      minWidth="955" 
                      minHeight="600" 
                      creationComplete="init()">
         <fx:Style>
              @namespace s "library://ns.adobe.com/flex/spark";
              @namespace mx "library://ns.adobe.com/flex/mx";
              /*
              s|Application {
              backgroundGradientColors: #000000, #222222;
              }          
              */
              s|Button#zoomInButton {          
                   skinClass: ClassReference("skins.ZoomIn");
              }
              
              s|Button#zoomOutButton {          
                   skinClass: ClassReference("skins.ZoomOut");
              }
              
              s|Button#fitToWindowButton {          
                   skinClass: ClassReference("skins.FitToWindow");
              }
              
              s|Button#fitToWidthButton {          
                   skinClass: ClassReference("skins.FitToWidth");
              }
              
              s|Button#fitToHeightButton {          
                   skinClass: ClassReference("skins.FitToHeight");
              }
              
              s|Button#rotateRightButton {          
                   skinClass: ClassReference("skins.RotateRight");
              }
              
              s|Button#rotateLeftButton {          
                   skinClass: ClassReference("skins.RotateLeft");
              }
              
              s|ToggleButton#rubberBandZoomButton {          
                   skinClass: ClassReference("skins.RubberBand");
              }
              
              
              
         </fx:Style>
         
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here 
              <s:Rotate id="rotator" angleFrom="{angle-90}" angleTo="{angle}" target="{img}"/>
              -->
              <s:Resize id="resize" target="{img}"/>
              <s:Rotate id="rotate" target="{img}"/>
              <!--<s:Resize id="contract" target="{img}"/> -->
         </fx:Declarations>
         
         
         <fx:Script>
              <![CDATA[
                   
                   import flash.net.navigateToURL;
                   
                   import mx.controls.Alert;
                   
                   [Bindable]
                   private var _imageURL:String = "images/earth-map_small.jpg";
                   
                   [Bindable]
                   public var angle:Number = 0;
                        
                   [Bindable]
                   private var borderHeight:Number;
                   
                   [Bindable]
                   private var borderWidth:Number;
                   
                   private var effectDuration:Number = 250;
                   private var defaultRotation:Number = 90;
                   
                   private var profits:Array;
                   private var dragStart:Point;
                   private var dragEnd:Point;
                   private var zoomingEnabled:Boolean;
                   
                   public var originalHeight:Number;
                   public var originalWidth:Number;
                   
                   public function init():void{
                        originalHeight = img.height;
                        originalWidth = img.width;
                        borderHeight = borderContainer.height - 5;
                        borderWidth = borderContainer.width - 5;
                   }
                   
                   
                   public function fitToWindow():void{
                        resize.end();
                        resize.duration = effectDuration;
                        
                        if(img.rotation == defaultRotation || img.rotation == -defaultRotation){     
                             resize.heightTo = borderWidth;
                             resize.widthTo = borderHeight;
                        }
                        else{
                             resize.heightTo = borderHeight;
                             resize.widthTo = borderWidth;
                        }
                        
                        resize.play();
                   }
                   
                   public function fitToWidth():void{
                        resize.end();
                        resize.duration = effectDuration;
                        
                        if(img.rotation == defaultRotation || img.rotation == -defaultRotation){
                             resize.heightTo = borderWidth;
                        }
                        else{
                             resize.widthTo = borderWidth;
                        }
                        
                        resize.play();
                   }
                   
                   public function fitToHeight():void{
                        resize.end();
                        resize.duration = effectDuration;
                        
                        if(img.rotation == defaultRotation || img.rotation == -defaultRotation){
                             resize.widthTo = borderHeight;
                        }
                        else{
                             resize.heightTo = borderHeight;
                        }
                        
                        resize.play();
                   }
                   
                   public function zoomIn():void{
                        resize.end();
                        resize.duration = effectDuration;
                        resize.heightTo = img.height*2;
                        resize.widthTo = img.width*2;
                        resize.play();
                        
                   }
                   
                   public function zoomOut():void{
                        resize.end();
                        resize.duration = effectDuration;
                        resize.heightTo = img.height/2;
                        resize.widthTo = img.width/2;
                        resize.play();
                   }
                   
                   public function rotateRight():void{
                        rotate.end();
                        rotate.duration = effectDuration-200;
                        rotate.angleFrom = angle;
                        rotate.angleTo = (angle += defaultRotation);
                        rotate.play();
                   }
                   
                   public function rotateLeft():void{                    
                        rotate.end();
                        rotate.duration = effectDuration-200;
                        rotate.angleFrom = angle;
                        rotate.angleTo = (angle -= defaultRotation);
                        rotate.play();
                   }
                   
    
                   private function initRectangle(e:MouseEvent):void{
                        
                   }
                   
                   private function showShowRectangle(e:MouseEvent):void{
    
                   }
                   
                   private function clearRectangle(e:MouseEvent):void{
    
                   }
                   
                   
              ]]>
         </fx:Script>
         
         <s:Panel
              id="mainPanel"
              left="5" 
              right="5" 
              top="5" 
              bottom="5" 
              title="FileNet Flex Viewer" 
              fontWeight="bold">
              
              
              <mx:ApplicationControlBar dock="true" top="0" left="0" right="0">
                   <s:Button 
                        id="zoomInButton"
                        toolTip="Zoom In"
                        click="{zoomIn();}"
                        />
                   <s:Button 
                        id="zoomOutButton"
                        toolTip="Zoom Out"
                        click="{zoomOut();}"
                        />
                   <s:Button 
                        id="fitToWindowButton"
                        toolTip="Fit To Window"
                        click="{fitToWindow();}"
                        />
                   <s:Button 
                        id="fitToWidthButton"
                        toolTip="Fit To Width"
                        click="{fitToWidth();}"
                        />
                   <s:Button 
                        id="fitToHeightButton"
                        toolTip="Fit To Height"
                        click="{fitToHeight();}"
                        />
                   <s:Button 
                        id="rotateRightButton"
                        toolTip="Rotate Right"
                        click="{rotateRight();}"
                        />
                   <s:Button 
                        id="rotateLeftButton"
                        toolTip="Rotate Left"
                        click="{rotateLeft();}"
                        />
                   <!--<s:ToggleButton 
                        id="rubberBandZoomButton"
                        toolTip="Rubber Band Zoom"
                        click="{}"
                        />
                   -->
              </mx:ApplicationControlBar>
              
              <s:BorderContainer 
                   id="borderContainer"
                   right="5" 
                   left="5" 
                   top="40" 
                   bottom="5">
                   
                   <s:Scroller
                        width="100%"
                        height="100%">
                        <s:Group>
                             <mx:Image 
                                  id="img"
                                  maintainAspectRatio="false"
                                  maintainProjectionCenter="true"
                                  source="@Embed('images/earth-map_small.jpg')"
                                  verticalCenter="0"
                                  horizontalCenter="0" 
                                  horizontalAlign="center" 
                                  verticalAlign="middle"/>
                        </s:Group>
                   </s:Scroller>
              </s:BorderContainer>
         </s:Panel>
         
    </s:Application>
    
     
    

    I think that this smaller version shows the consisently (attached JPG) question:

    http://ns.Adobe.com/MXML/2009.
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" >
       
       
            public function fitToWindow (): void {}
    IMG. Height = borderContainer.height;
    IMG. Width = borderContainer.width;
    }
    ]]>
       

       
       
           
       

       
       
           
               
                   
    horizontalCenter = red '0' = '0' / >
               

           

       

       

    Looks like the interaction of Red/horizontalCenter with the add/remove scroll bars causes a loop.  Can you please fill a bug report and post the link here?  (Or let me know if you prefer that I have put it).

    The workarounds are:

    1. in the fitToWindow() method to subtract enough pixels to consider both sides of the border, for example:

    public function fitToWindow (): void {}
    IMG. Height = borderContainer.height - 2;
    IMG. Width = borderContainer.width - 2;
    }

    2. always keep the scroll bars displayed, for example:

    3. instead of use BorderContainer use SkinnableContainer/group and draw the border outside the container, for example:


           
               
                   
               

           

      
           
               
                   
                       
    horizontalCenter = red '0' = '0' / >
                   

               

           

       

    Let me know if these solutions of workaround for the case also reduces work for your application.

Maybe you are looking for