Is it possible to resize the document, but keep the content proportions?

With scripts, there are currentDocument.resizeImage () and currentDocument.resizeCanvas (). ResizeImage() method stretches the image. The resizeCanvas() will resize the canvas but not change the size of the image.

I'm looking to resize the canvas to a new format, but keep the aspect ratio of the content. Is there a way to do this?

OK, I got it working!

adjustedWidth = width;

adjustedHeight = height;

If (imageAspectRatio > targetAspectRatio) {}

adjustedHeight = width / imageAspectRatio;

}

else {}

adjustedWidth = height * imageAspectRatio;

}

currentDocument.resizeImage (adjustedWidth, adjustedHeight, null, resampleMethod);

currentDocument.resizeCanvas (width, height, AnchorPosition.MIDDLECENTER);

Tags: Photoshop

Similar Questions

  • Is it possible to resize the content of at the same time multiple bounding boxes by using number fields in the toolbar?

    I'musing cs6 and need to resize an image and two text boxes on a specific pixel width.

    I try to select all the boxes and punching in 960 px in the resizing of the toolbar field, but only the bounding boxes and not their content get resized...

    Use the field of horizontal scaling (and include units) rather than the field width.

  • Storm: is it possible to resize the horizontal width of the Manager?

    Hi all

    Is it possible to resize the horizontal width of the Manager. I want to create two buttons in horizontal management, set the border background. I use the following code to do this. It works very well. But as there are only two buttons and does not occupy the whole of the 320 width screen, frame border is happening only for these two buttons background. So I could see the spaces apart from the horizontal width in front and in rear areas. So I want to create a horizontal Manager himself with a width of 320, so that the layout border color indicates the full width. Is it possible to resize the horizontal width of the Manager?
     
    XYEdges borderColor = new XYEdges (Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK);
    NoPadding XYEdges = new XYEdges (2, 2, 2, 2);

    HorizontalFieldManager hzBtnFldManager = new HorizontalFieldManager (HorizontalFieldManager.FIELD_HCENTER);

    new CustomControl = createButton ("Create", ButtonField.FOCUSABLE |) ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER, 83, 15);
    cancelButton = new CustomControl ("Cancel", ButtonField.FOCUSABLE |) ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER, 83, 15);

    hzBtnFldManager.add (createButton);
    hzBtnFldManager.add (cancelButton);

    At the border btnBarPaddingBorder = BorderFactory.createSimpleBorder (noPadding, borderColor, Border.STYLE_SOLID);
    hzBtnFldManager.setBorder (btnBarPaddingBorder);
    hzBtnFldManager.setBackground (BackgroundFactory.createSolidBackground (Color.GRAY));

    this.setStatus (hzBtnFldManager);

    Resolved using HorizontalFieldManager (Field.USE_ALL_WIDTH);

  • What is the best way to resize an image, but keep the height and width of the same original size or format?

    What is the best way to resize an image, but keep the height and width of the same original size or format?

    I tried to use the function of the size of the Image, but when I changed the size of the image, the width has not changed with it.

    Thanks for the tips!

    Hi Landon.Luu,

    You want to keep the relationship between the width and height to be the same?

    Click the constraint between width and height to keep the ratio intact.

    Kind regards

    Claes

  • Possible to change the contents of text inside the group frame?

    Hello world

    I'm newbibe to Indesign forums.

    I had grouped image placed on the rectangle frame and the text. now I need change content text frame using indesign Javascript

    Possible to change the content of text inside the group frame... ?

    -yajiv

    Hello

    Try the following lines.

    main();
    
    function main() {
    
        if  (app.documents.length != 0  &&  app.selection.length == 2 ) {
            if( app.selection[0].constructor.name == "Group" && app.selection[1].constructor.name == "Group" ) {
                var sel1 = app.selection[0];
                var graphics1 = sel1.allGraphics[0].itemLink;
                var text1 = sel1.textFrames[0].contents;
    
                var sel2 = app.selection[1];
                var graphics2 = sel2.allGraphics[0].itemLink;
                var text2 = sel2.textFrames[0].contents;
    
                sel1.textFrames[0].contents = text2;
                sel2.textFrames[0].contents = text1;
    
                var fP1 = File( graphics1.filePath );
                var fP2 = File( graphics2.filePath );
    
                graphics1.relink( fP2 );
                graphics2.relink( fP1 );
            } // if
            else {
                alert ( "Select 2 groups!" );
            } // else
        } // if
        else {
            alert ( "Wrong selection!" );
        } // else
    } // main
    

    Although it might work for you, it is probably not advisable, because if you apply other content on the chassis, you modify the content, but not the formatting. Even with the restoration of the links of the images.

    So a better solution may be, separate frames, move them and group them back.

  • Is it possible to read the contents of the XML file rather than the properties for the location of FLEX

    Is it possible to read the contents of the XML file rather than the properties for the location of FLEX

    Strictly speaking, this is not really true. When running, the ResourceManager of IResourceBundles for localization, not deal with XML files or properties files. As long as you implement IResourceBundle, you can back it up with XML, properties, JSON, AMF files - what you want. The problem is that mxmlc will not build modules of resources for you what it is, with the exception of properties files, and cannot compile just resource bundles in a .swf using anything other than properties files. If you build your own interface to spit IResourceBundles, this could work, but it is probably more trouble that it's worth.

    (Assuming that you establish the link in the application) the best solution is to write a script to pre-process the XML in properties files.

  • Is it possible to resize the slide?

    Hello

    I have a model that I use for my e-learning to keep a consistent look, and because I've set up a few advanced actions.  A project, I need to slightly adjust the height of the blades.  Is this possible?  I want to keep all the slides, and their associated objects and their actions, just the resizing so that I can keep a little more on the screen.

    Hoping that this is possible and that someone knows a way to do this, but a quick search on Google and in the user of Captivate interface did not reveal anything.

    I use Cp5.5 but may upgrade or downgrade if necessary.  Thank you all!

    Have you tried to edit, resize? Be careful when choosing options to avoid quality loss, because CP is all about bitmap. It would have been better to resize the model before adding additional objects.

    Lilybiri

  • Is it possible to resize the bar of menus and other toolbars to make them smaller vertically?

    With the update for Firefox 4 my bar menus and toolbars are now take up significantly more space than they where before - is it possible to resize them so that they take up less space?

    You can try one of the compact themes.

  • Is it possible to resize the image size for all clips at once?

    I have a video of music finished and when I export there is a black box around the video. I tried to put the exported file back in first and by resizing the area program, but when I exported the video became unstable. I could resize each item individually in the first original file, but it would obviously take a lot of time, so I was wondering if there is a way to select them all and resizing, or even another way to cut out the black bars (trying to size for youtube). Thanks for any help, it is much appreciated.

    -Josh

    Josh,

    Welcome to the forum.

    The best way to handle things is to choose a pre-defined sequence that matches your footage source of the layer at 100%.

    In light of the where you are now, you can go to your first Clip and adjust the fixed effect > Motion > adapted for her greatness. Then, Rt-click on it, choosing the copy. Now select all the other Clips (Lasso with the slider will work) and then Rt click, choose the attributes of the dough.

    CS5 offers a new tool to configure your sequence. Import your footage source of the layer, then select it in the project Panel, drag it to the new icon to get a corresponding sequence.

    Good luck

    Hunt

  • Is it possible to resize the window of the CC customer?

    One of the computers that use with Creative Cloud is a laptop with a resolution of 1366 x 768.

    The CC customer opens and runs right on the bottom of the screen. I was wondering if there was anyway to resize the client?

    Hi G.S. Kelly,.

    Welcome to the community!

    We can not resize application cloud creative right now, if you want you can pin in however resize the Notification area is not available.

    Thank you!

    Ankit

  • Resize the content and mulitple art advice?

    Long story short, I do the formatting of a book, adding images, etc. I received an e-mail yesterday that the size has changed. Problem is, I did so far more than 100 pages, and they are broken

    down in 10 pages / files.

    Please tell me there is a way to batch resize all this?  I don't mind doing 10 pages in time, do not want to resize all images. The text, although most likely will need to be

    handmade. Unless there is a way to export a PDF file to the right size? Or that you resize in PDF format...

    Try this thread:

    Is it possible to resize all work plans at the time the way that you used to be able to do in the configuration of document?

    You really should work in InDesign.

  • Several graphic frames: resize, adjust the content proportionally, Center the content

    Hello assistants scripts! I hope one of you can help me in this simple task. How I wish that the acts were an option! I read the messages saying how from simple scripts to apple is. I have read the tutorial from start to finish and doing the exercises. I have copied excerpts from multiple sources, and the only thing I could do is to insert the content... but not proportionally.

    I use INDD CC. I have a dozen pages in tabloid format with a hundred images illustrator on each square. Here's what I have to do for everyone from graphic images:

    1. that all graphic frames the same size: 10 x 10 mm

    2. Insert the content to frame proportionally

    3 Center in the framework

    Can anyone help? Thank you!

    Hey Kevin,

    These dang millimeters! The script that I came by default to pixels of all things. So my solution (actually two scripts) isn't pretty, but it works but he paints with a broad brush... each rectangle. I hope to add a line repeat like yours, so I can see what I want. A blogger out there in the Land of script sent me a few ideas on how to combine and improve them; I hope soon to sink into their logic. These are the two that I came up with:

    Resize the frame 10 x 10 mm

    say application "Adobe InDesign CC 2014"

    activate

    say an active document

    Resize each Rectangle in internal coordinates anchor of Center of replacement of the current dimensions with values {30, 30}

    end say

    end say

    Insert the picture content (proportionally, centered)

    say application "Adobe InDesign CC 2014"

    activate

    say the active document

    say each Rectangle

    fit content to frame

    adapt given proportionally

    adapt content Center

    end say

    end say

    end say

  • Is it possible to compare the contents of two folders

    Someone copied one of our folders with subfolders on the server from one place to the other. Now, some people use the old location and the new location. Is it possible to compare the two, to find the difference and merge them into a file without losing any information?

    There are third party tools that can automate a large part of it, but you still need to judge what part gets merged from which file.  One of those tools that I know is "Beyond Compare"

    Beyond Compare: <> http://www.scootersoftware.com/index.php >

    Not free, but in my humble OPINION is worth the price.

    HTH,

    JW

  • I can't resize the frame proportionally and object set and I can not drag and copy objects.

    Hello

    more than an hour on these problems:

    (1) I can't just drag and copy an object more

    (2) I can't resize an object and its setting selecting just. I can resize the frame only (not proportionally, however, doesn't matter the number of keys that I use!). Not the object it contains.

    I work with INDESIGN CC 2015 latest version (I've just updated) and on MAC OSX Yosemite 10.10.5

    I regret the money I spend each month to pay for these programs.
    Whenever I update them I have 1000 problems.

    I don't know even how to replace the preferences that I don't know what I should replace. And sorry if I sound stupid, but when you have to deal with a stupid task is what is happening. I refuse to understand.

    Honestly, this is such a stupid problem, and it should not exist on a first place. BAD BAD BAD ADOBE!

    Chiara

    Hello

    two days after, and a new update, it was back again.

    I think they were all preferences.

    @Rob: I used command-Shift and it always works when the black Selection tool is active. By selecting and dragging to create a copy of the object.

    It was just strange and frustrating.
    Thank you for your answer!
    Chiara

  • is it possible to increase the content of a digital picture by a constant.

    Hello

    I use the universal library to read a voltage from a data acquisition device, and it seems that the playback feature is put in a 1 d table then in a chart.

    I need to get this tension and multiply by a number and couldn't just as it is in table format.

    How would I be able to multiply the contents of the table by a constant digital?

    Thank you

    When you try to multiply the value that you must take the value of the waveform, as shown below or by reading the value itself you could choose 1 double d instead of waveform.

    Good luck

Maybe you are looking for