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

Smartobject size to 100%

Participant ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Hello all,

is there a possibility to bring a smartobject to exactly 100% by script. This would help me a lot.smartscale.jpg

TOPICS
Actions and scripting

Views

6.3K

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
LEGEND ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

runMenuItem(stringIDToTypeID('placedLayerResetTransforms'))

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
Valorous Hero ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

quote
runMenuItem(stringIDToTypeID('placedLayerResetTransforms'))

By @Kukurykus

Interesting. But does not work in 2020.

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
LEGEND ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

I don't know when it was implemented, but probably it's something quite new. Try not by ran item, but traditional way, however I think that will fail too if I guess you don't have it in panel.

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 ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

It was added in one of the newer Creative cloud version of Photoshop. It will reset the warping of a Smart Object Layer's  Object transform.  However a Smart Object may be shared by other duplicated smart object layers.  Each smart object has a different Object Transform.  All the other layers transform will not be reset and even the smart object layer with the reset transform   positioning over the canvas does not seem to be reset if the reset transform was also used to position the layer.

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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

A fuction call/function that you will find on this forum in multiple scripts, where varSomeFile may be a variable to a single file or multiple files:

 

 

placeFile(varSomeFile, 100);

 

 

 

function placeFile(file, scale) {
    var idPlc = charIDToTypeID("Plc ");
    var desc2 = new ActionDescriptor();
    var idnull = charIDToTypeID("null");
    desc2.putPath(idnull, new File(file));
    var idFTcs = charIDToTypeID("FTcs");
    var idQCSt = charIDToTypeID("QCSt");
    var idQcsa = charIDToTypeID("Qcsa");
    desc2.putEnumerated(idFTcs, idQCSt, idQcsa);
    var idOfst = charIDToTypeID("Ofst");
    var desc3 = new ActionDescriptor();
    var idHrzn = charIDToTypeID("Hrzn");
    var idPxl = charIDToTypeID("#Pxl");
    desc3.putUnitDouble(idHrzn, idPxl, 0.000000);
    var idVrtc = charIDToTypeID("Vrtc");
    var idPxl = charIDToTypeID("#Pxl");
    desc3.putUnitDouble(idVrtc, idPxl, 0.000000);
    var idOfst = charIDToTypeID("Ofst");
    desc2.putObject(idOfst, idOfst, desc3);
    var idWdth = charIDToTypeID("Wdth");
    var idPrc = charIDToTypeID("#Prc");
    desc2.putUnitDouble(idWdth, idPrc, scale);
    var idHght = charIDToTypeID("Hght");
    var idPrc = charIDToTypeID("#Prc");
    desc2.putUnitDouble(idHght, idPrc, scale);
    var idAntA = charIDToTypeID("AntA");
    desc2.putBoolean(idAntA, true);
    executeAction(idPlc, desc2, DialogModes.NO);
}

 

 

 

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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

What do you mean by 100%.  and is the smart object a Placed image file. Place scale smart objects,  In fact place may scale a smart object twice.  Once because there are different print resolution  in the Place image File the  document it is placed into a document and second second scaling if the smart object layer does not fit on canvas and your Photoshop preferences is  set to resize during Place. 

 

Script can scale a smart  layer to fill some area and mask  it to the area aspect ratio and shape.  I do that all the time.  Scaling a  smart object layer object transform to 100% may not be the size you are expecting the object  to be because Place may have scaled the object because of different resolution are involve.  Smart object layer implementation is more complex then most users think.

 

New versions of Photoshop have reset place layers transform I do not know if that will reset the PPI scaling Place may as well at place resize and user transform. It may I did not test that though.

 

I just tested reset place layers transform will reset all transforming done to the smart object sizing  and warping but positioning is not changed  so if the  transforming also move the positioning that will not be reset.

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
Participant ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Hello JJMack,

I have a document with a resolution of, for example, 100 dpi and then place images with different resolutions (dpi) as Smart Objects.
In order for the print size to be correct, however, I have to set the smart objects to exactly 100%, so a simple reset of the transformation is unfortunately not possible.

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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

What size do you expect the object  place size to be in the document what is the place image file's Aspect Ratio compared to the document aspect ratio, what is the Image  file canvas size compared to the document canvas size. Photoshop is a Pixels editor. 

 

The Place Command has an interactive transform the user can use you scale the Place image. If you do not maintain the Image's Aspect Ration Transferring the image to fill the canvas the image will distort. If the Image has a different aspect ratio then the document some image content will be clipped off by the  documents canvas aspect ratio if you maintain the images aspect ration and it is different than the documents aspect ratio.

 

How do you want to handle aspect ratio miss matches.

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
Participant ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

I knew it was going to be a little more complicated. I need the print size and no matter what dpi the smart has, if I set this to 100% in Photoshop 20121 then they always have the print size! It must be possible somehow to set the smart object to 100%, as I would do it by hand?

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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

What Image Aspect Ratio paper size and print  resolution are you writing about.  Images can be any size and have any aspect ratio.  You can change the size an image prints by changing the Print PPI resolution. That  will not change an image's aspect ratio. A wide panorama will still be a wide panorama  a portrait will remain a portrait and a landscape will remain a landscape.  You can resize any aspect ration image to fit on 8"x 10" paper however; only  images that have a 4:5 or 5:4 aspect ratio will fill the paper all other aspect ratio image will have boarders on two sides the image will fill just the height or width of the paper.

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
Participant ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Good morning JJMack,
I mean the print size of the smart object, the aspect ratio and the document into which I load the smart objects do not matter at first.

The image is always brought to the correct size proportionally.
It can only happen that the image is larger than my workspace due to the print size, but I can fix this with a mask.
As an example:
I have a PSD with 200dpi and the canvas is 1cm x 1cm.
If I load this PSD as a smart object into a document with 100dpi, I have to set the size of the smart object to 100% so that the smart object is now also 1cm in size.
If I set the size back, the smart object is now 2cm big, but I don't want that.

 

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 ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

If  you have a an open document that has the aspect ratio  of the paper you want to print on you can  set the length of  side and the print resolution you want to print.  Photoshop will calculate the number of pixels required and change the number of white pixels the canvas need to be to print that size.  Once you have the documents canvas for the size and print resolution.  You can place in any size image and scale the smart object to fit the canvas. Only images that have the same aspect ratio as the paper will fill all the canvas area.  Images that have other aspect ratios will  have white borders on two opposite sides.  The percentage the smart object need to be scaled depend on the Image's size and the document's canvas size and their aspect ratios.  The percentage need to be calculate.  You could write a Photoshop script to automate this process, The script would have yous select the image file you want to place onto the canvas. Once you select the image file the script will place in the image and scale it for the canvas size and position it centered to the document's canvas and may rotate the image for best fit. The scaling required can be any percentage less then, equal to, or grater than, 100%.

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
Participant ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

Is there no easy way to set the smartobjekt size to 100%?

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 ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

You do not seem to undetstans what setting a smart object scale to 100% does. 

 

You seem to think that would make your smart object layer your document size or some other size you want.  A smart object may be any size  a few pixels, your canvas size, many time larger then your document canvas size.

 

You want your Smart Object Layer to fit some something that is in your head.  You are asking the wrong question. It is very easy to scale a smart object layer to the object size  so the layer will contain the object's  actual pixels all 100% of them.  All 16 of them, all 16 billion of them.  A layer can be any size and  have any aspect ratio within Photoshop limits. That does not seem the be what you want to do.  You seem to want it to be some size it is not. You want it to be resized for a size you want it to resize to.

 

You seem to  think 100%  size is some particular size. A smart object may be any size within Photoshop limits. I believe Photoshop layer size document size limit is 300,000px by 300,000PX.  Photoshop is a pixel editor there are limits.

 

In the new document dialog  I kept typing nines in the width, height, and resolution filds till their outline turned red then Photoshop set in the fields limit

image.png

0 size is not possible however you can create a 1 pixel document.

image.png

with a 1 ppi resolution it will print 1" x 1".

 

image.png

 

Document size range 1Px to 90,000,000,000

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
Valorous Hero ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

Doesn't the variant suggested by Kukurykus work for you?

 

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 ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

From what they wrote I do not know exactly what they are doing or are after.  They used "Load Image"  when they used place and saw the smart object was scaled  by "Place" because of the different print resolutions. I also think they saw the Smart Object Layer would  be scald to fit on canvas if the object was scaled larger or is larger than canvas size. They also wrote about the document DPI and use  dimensions in CM not inches.    They provided no details about the documents Canvas size  dimensions in pixels or why they did not use Place's interactive transform to scale the smart object layer to the size they seen to want of if they used an automated place that did not have an interactive transform.   I have scripts that can be use in place of Photoshop place command that  scripts place so there will be no mismatch Print resolution.  The script simply changes the document's print resolution to match the image file being place in print resolution then places the image file into the document then restore the document's print resolutions back to what it was.  Adobe stated they do the scaling to be compatible with other Adobe applications. (I do not know for sure make Photoshop look more like a vector application like AI). The object is created with all the object actual pixels Place just scales the object for the layer. I do not use other Adobe application.  Photoshop has too many issues. I do not need other complex applications with too many issues.

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
Valorous Hero ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

It seems to me that the author just wants to turn the numbers 157.27% in the first screenshot into 100%.

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 ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

You can even do that in and action record a transform current layers  Width and Height set to 100%.   I do that in my collage scripts after I place in an image file. To make sure the smart object layer was not scaled by place resiz during place preference which will scale a smart object layer to fit on canvas even when there is no resolution mismatch.  I needed to get the layer the be the same size as the object I could get the layer bounds to get  the size of the actual object so I could calculate the percentage I  needed to scale the image to resize it for the size I need to make it.  The thing that  Reset Smart Object transform does that transform  current layer 100% width and 100% height  does not do. Reset smart object transform also reset the layer warping.  Resetting a smart object layer's transform is not something one should do in a Mochup template the warping was done so the object would conform to some element in the mockup content. It distort the object for the mockup composite image and there can be more then one smart object layer sharing a smart object there cans be several warping transform for an object in a mockup template

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
Valorous Hero ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

quote

You can even do that in and action record a transform current layers  Width and Height set to 100%.   


By @JJMack

 

Have you personally tried this with Action?

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 ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

No I have never tried to record such an action.  I have only resize the active smart object layer in a script.

activeDocument.activeLayer.resize(100 ,100,AnchorPosition.MIDDLECENTER);

in a  place function.

 

 

function placeImage(file) {
	// =======avoid bug in cs2 and maybe CS4 ==================================
	var idslct = charIDToTypeID( "slct" );
	    var desc5 = new ActionDescriptor();
	    var idnull = charIDToTypeID( "null" );
	        var ref3 = new ActionReference();
	        var idChnl = charIDToTypeID( "Chnl" );
	        var idChnl = charIDToTypeID( "Chnl" );
	        var idRGB = charIDToTypeID( "RGB " );
	        ref3.putEnumerated( idChnl, idChnl, idRGB );
	    desc5.putReference( idnull, ref3 );
	    var idMkVs = charIDToTypeID( "MkVs" );
	    desc5.putBoolean( idMkVs, false );
	executeAction( idslct, desc5, DialogModes.NO );

	// Place in the file
	var idPlc = charIDToTypeID( "Plc " );
	    var desc5 = new ActionDescriptor();
	    var idnull = charIDToTypeID( "null" );
	    desc5.putPath( idnull, new File( file ) );
	    var idFTcs = charIDToTypeID( "FTcs" );
	    var idQCSt = charIDToTypeID( "QCSt" );
	    var idQcsa = charIDToTypeID( "Qcsa" );
	    desc5.putEnumerated( idFTcs, idQCSt, idQcsa );
	    var idOfst = charIDToTypeID( "Ofst" );
	        var desc6 = new ActionDescriptor();
	        var idHrzn = charIDToTypeID( "Hrzn" );
	        var idPxl = charIDToTypeID( "#Pxl" );
	        desc6.putUnitDouble( idHrzn, idPxl, 0.000000 );
	        var idVrtc = charIDToTypeID( "Vrtc" );
	        var idPxl = charIDToTypeID( "#Pxl" );
	        desc6.putUnitDouble( idVrtc, idPxl, 0.000000 );
	    var idOfst = charIDToTypeID( "Ofst" );
	    desc5.putObject( idOfst, idOfst, desc6 );
	executeAction( idPlc, desc5, DialogModes.NO );

	// because can't get the scale of a smart object, reset to 100%
	if (version!="9.0.0") activeDocument.activeLayer.resize(100 ,100,AnchorPosition.MIDDLECENTER);

	return app.activeDocument.activeLayer;
}

 

 

I just tried and transform 100% width and 100% height  however if does not set  the smart correct layer's object  transform to 100% size the smart object layer transform remain the same as it was set..  Transform may require a relative change from what it currently is. In newer  Photoshop version you can record Reset Transformations which will reset  the layer'e transform  scaling and warping. I do not know how to retrieve the smart object layer current scaling to to be able to set a transform change so the result will scale to 100% smart object size.  R-bin you may be able to code Action manager code to do that.  That is above my pay grade.

image.png

 

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
Participant ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

Hello and thank you anyway, I have also tried to record an action, but here it is then always scaled by the % and not to the desired 100% of the smart object. If I have different resolutions for the smart objects it also does me no good to bring the document to the dpi of the smart object. It could be that you know a relatively simple method to set the value of the smart object to 100%. Then I have no choice but to set the value to 100% manually.

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 ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

LATEST

If you have a newer Photoshop version you can record Reset Transformations which will reset  the layer's transformed size and shape. That should work if you want to sized to the actual object's size and shape.

 

However, that may not be what you want. If the object was Placed in an automation and, then you did a free transform to change the percentages Place set to 100% and the worked for you.  Place may actually do two scaling and the value you see in the Place tool option bar  transform may be relative to the Actual Object size or relative to Place's scaled object size.  I know that sounds strange but its what I have observed. 

 

Place will scale the object if the Image File being placed in Print resolution is different than the current document resolution in Photoshop.   When you Copy and Paste, Duplicate layers, dragle layers between documents there is no scaling done.  Place is in different it may scale the object.    If  Place's Object does not fit on the documents Canvas and your Photoshop's Place Preference is set to resize during Place.  Place will scale the Object to fit on canvas. So the values you see  in the Place tools option bar may be relative to the Object size or relative to Places's scaled object.   

 

Photoshop renders pixels for the smart object and harden those pixels. Photoshop tools can not change a smart objects pixels  These are not the layer Pixels. Place will generate the layer's pixels from the hardened Pixels  If Place Scale the object because of Print resolution are differ the Layer will have a different anoint of Pixels than the actual object. If the layer's Pixels do not fit on the documents canvas,  Place will scale the Layer's Pixels to fit on canvas.  So the value in the place transform  I claim can be relative to the object size or relative to the scaled size.       If I'm right if you change the values in the Layes transform to 100% the layer may resize to the Smart Object size or to Place's scaled object size.   The new Photoshop layer option Reset Transform records in an action as Reset transformations and in the history palette as reset Transforms in both  plural not a single Transform.  A single Transform can scale, warp and position a layer.   So why recode the plural not just Transform.  Reset Transform will reset both scaling and any warping  but not reset any positioning one. Therefore, setting the Transforms values to 100% and Smart Object Layer Reset Transform may result in different layer size.   

 

Place confuse more than one user. It beat me up.   Let me see if I  can help you observe what  I wrote.  I will try to create screen captures the to help you observe what is going on.  To that end I will open new document side for the web and edit with a 100ppi resolution.  I will "Place" in a 8.2 MP RAW file where my ACR default work flow setting are 16 bit color full size 300 ppi. So "Place" should do both scaling s and the layer will be 8bit color because of the web size document I opened. I will accept Place's default transform and you will see its transform values.  These values will be relative to "Place's" scaled size if you accept the places defaults. Do  not accept the values or layer edit the layer's Photoshop will set the values relative to the actual objects size.  The is one of the quirks the beat me up. Photoshop operation seemed to be inconsistent.  I thought if I set the values to 100% the layer bounds would always be the object actual size.


You can see here that the Place transform to 42.75%  was set relative to Place's scaled size not to the actual 8.2 MP object size.  However if I edit the transform alter the warping. Not the scale.  Photoshop will switch the scaling values to be 14.26% relative to the actual 8.2MP object size. Place beat me up with it scaling and switching relativaty I'm no Einstein place leve me be.

Capture.jpg

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