• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Image Fit to Canvas Option

Explorer ,
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

Hello Adobe Community!

I'm a Graphic Designer.

To present my design as a mock-up I always use Adobe Photoshop. So, when we want to change the .psb file we need to place new design and of course we need to place image in whole canvas. But reason of different size or resolution images we always drag image (Edge to Edge) to Fit in Whole Canvas. For 1 or 2 mock-ups it doesn't matter but when we mock-up a Book or Brochure with a huge number of pages then we need drag image for all pages. It's take too long to complete all pages mock-up. There is a option as I know that 'I can create Fit to canvas Action' but it's not work for all mock-up. Please help me if there is another easy option to Fit .psb image in whole canvas by One Click. Otherwise, I'm requesting to Adobe Systems to give us a Button like below attachment... Thanks in advance.

Fit to Canvas.jpg

TOPICS
Actions and scripting

Views

3.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guest
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

fainbox  wrote

Otherwise, I'm requesting to Adobe Systems to give us a Button like below attachment...

Hi

Feature request can be made here Photoshop | Photoshop Family Customer Community

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

fainbox  wrote

when we mock-up a Book or Brochure with a huge number of pages then we need drag image for all pages. It's take too long to complete all pages mock-up.

Hi

The default is proportional now, and going edge-to-edge can distort, so you might have to stop short or extend past the canvas. I'm sure you are aware of that, but you didn't say, so I have to confirm.

Your new image is in the exact center (I checked). If that's always the case, will it work if you hold down Option (Alt) and drag any handle to resize from the center? I like using a side handle, such as the bottom center.

I don't use frames in PS, but in InDesign there many choices as to how to fit an image into a frame and they can be saved as an Object Style and (if desired) set it as the default for every image in your book. If you have InDesign, you could try that. If not, maybe someone who knows PS frames better can say whether or not that's even an option for what you are trying to do.

~ Jane

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2019 Jun 16, 2019

Copy link to clipboard

Copied

Hello Jane, thanks for your reply in my content. Yeah, "it works if I hold down Option (Alt) and drag any handle to resize from the center". But I need just like Adobe InDesign options 'Fit an image into a Frame', but Instead of 'Frame' there should be 'Canvas' in Photoshop. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2019 Jun 16, 2019

Copy link to clipboard

Copied

Hello Jane, thanks for your reply in my content. Yeah, "it works if I hold down Option (Alt) and drag any handle to resize from the center". But I need just like Adobe InDesign options 'Fit an image into a Frame', but Instead of 'Frame' there should be 'Canvas' in Photoshop. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2019 Jun 16, 2019

Copy link to clipboard

Copied

The following script by default will fit the selected layer to canvas, stretching the content to fit. It is very easy to make it maintain aspect ratio and fit to the width or height without stretching. Using the forum search feature, there are many solutions if this does not do what you require.

 

// FIT LAYER TO CANVAS
// via https://forums.adobe.com/message/5413957#5413957
// https://gist.githubusercontent.com/jawinn/ab4df1c33d0743e41fd3/raw/72ff297ae42ed029c86be7644bd021ef4...
var maintainAspectRatio;
// var maintainAspectRatio = true;// set to true to keep aspect ratio  
if(app.documents.length>0){  
    app.activeDocument.suspendHistory ('Fit Layer to Canvas', 'FitLayerToCanvas('+maintainAspectRatio+')');  
}  
function FitLayerToCanvas( keepAspect ){// keepAspect:Boolean - optional. Default to false  
    var doc = app.activeDocument;  
    var layer = doc.activeLayer;  
    // do nothing if layer is background or locked  
    if(layer.isBackgroundLayer || layer.allLocked || layer.pixelsLocked  
                            || layer.positionLocked || layer.transparentPixelsLocked ) return;  
    // do nothing if layer is not normal artLayer or Smart Object  
    if( layer.kind != LayerKind.NORMAL && layer.kind != LayerKind.SMARTOBJECT) return;  
    // store the ruler  
    var defaultRulerUnits = app.preferences.rulerUnits;  
    app.preferences.rulerUnits = Units.PIXELS;  
      
    var width = doc.width.as('px');  
    var height =doc.height.as('px');  
    var bounds = app.activeDocument.activeLayer.bounds;  
    var layerWidth = bounds[2].as('px')-bounds[0].as('px');  
    var layerHeight = bounds[3].as('px')-bounds[1].as('px');  
          
    // move the layer so top left corner matches canvas top left corner  
    layer.translate(new UnitValue(0-layer.bounds[0].as('px'),'px'), new UnitValue(0-layer.bounds[1].as('px'),'px'));  
    if( !keepAspect ){  
        // scale the layer to match canvas  
        layer.resize( (width/layerWidth)*100,(height/layerHeight)*100,AnchorPosition.TOPLEFT);  
    }else{  
        var layerRatio = layerWidth / layerHeight;  
        var newWidth = width;  
        var newHeight = ((1.0 * width) / layerRatio);  
        if (newHeight >= height) {  
            newWidth = layerRatio * height;  
            newHeight = height;  
        }  
        var resizePercent = newWidth/layerWidth*100;  
        app.activeDocument.activeLayer.resize(resizePercent,resizePercent,AnchorPosition.TOPLEFT);  
    }  
    // restore the ruler  
    app.preferences.rulerUnits = defaultRulerUnits;  
}  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2019 Jun 16, 2019

Copy link to clipboard

Copied

If you maintain aspect ratio and the image has a different aspect ratio then the canvas the resizes image does not fill the canvas fill the canvas and if you do not maintain the aspect ratio the resize image is distorted.

Maintaining the aspect ratio and then using  content aware fill will also add distortion.

What I normally do is to resize the layer to fill the canvas.  The canvas will act as a clipping mask the resize image looks like a centered aspect ration crop resized to fill the canvas.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2019 Jun 13, 2019

Copy link to clipboard

Copied

Place has a transform so you should be able to transform you should be able to fit your design to the documents canvas.  You should constrain you transform to your design aspect ratio so it will not distort.  You also need to be careful when you use Place it will degrade your design. If the File Print DPI resolution do not match the resolution of the document you are placing the the image into.

If by Mockup  you have created a Mockup Template that has your design in it as a Smart Object layer.   If you are replacing the design  using Layer>Smart Object>Replace Content.  The replacement files need to be exactly the same Aspect Ratio, have the same number of Pixels and have the same Print DPI resolution as the Object . Replace content is like Place however the existing Associated  Layer transform is not updated  a smart object may be shared by other smart Object layers all  the layers that share  the object content will be replaced their existing layers  transform are the Originals Object.   There is an other way to replace the Smart Object layer content by opening the object and editing it. Still you should not change the work document size and resolution.  You would fit your replacement to the work document canvas.

Both method can be scripted.  My Batch Mockup Scripts can use either method.  They default to using Replace Content which requires all replacement to have the right Aspect Ratio, Size and Print Resolution.   If the replacement do not the scripts have a edit option and a couple of edit options that can rotate the design for best fit and resize the design to fill the canvas or  be fitted to the canvas.

I feel you need to automate the process and do something else while Photoshop Is cranking out your mockups.  However, I do not understand why your Mockup are so complicated that  you need to use  PSB files.  That sounds more like  you trying to put all you designs into a single document. The is asking for problems and Photoshop performances handling all the date is not something I would want.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2019 Jun 16, 2019

Copy link to clipboard

Copied

LATEST

What you have presented in screenshot does not seem to be mockup, it is flat image which needs some object/pixels to be replaced actually covered in the middle of canvas/image. If you create layered file there will be many options to replace what is in the middle or any part/layer content. Things will be even easier if object is always in the same dimensions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines