Highlighted

How to resize the image size by percentage ?

Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

DEAL ALL,

GREETINGS!

 

I'm facing a small problem. There is aproject i'm developing script for. Anyhow, the designers asked me somthing and since I'm not a designr, so I don't have a clue how to do it from the UI so i can understand how to do it wit script.

 

So, they asked me to decrese the size of image to make it 30% because the current size is 50%. It's applicable with code? i dont even changed the size of image! i Just place the image and use the fit functons to make it smaller and better, check my code, below:

var doc = app.documents.add()
			
			var image = File.openDialog("Please try to select the icons folder");
		
			
			var rect1 = doc.pages[0].textFrames.add({
				geometricBounds:  [12.7, 12.7, 90, 90]
			});

			rect1.place(image)
			rect1.fit(FitOptions.PROPORTIONALLY)
			rect1.fit(FitOptions.FRAME_TO_CONTENT)

			app.activeWindow.viewDisplaySetting = ViewDisplaySettings.HIGH_QUALITY;

However, is it possiable to decrease the image size by percentege? and how?

I'm using JS.

Thanks all.

I think it's enough to change frame size.
90 - 12.7 = 77.3
but it's only 50℅ ...
ok! 77.3 * 2 = 154.6
we need 30℅, i.e.
154.6 * 30 / 100 = 46.38 + 12.7 = 59.08
and now we can write:
geometricBounds: [12.7, 12.7, 59.08, 59.08]

 

TOPICS
Activation billing and install, Bug, EPUB, Feature request, How to, Import and export, InCopy workflow, Performance, Print, Publish online, Scripting, SDK, Server developers, Sync and storage, Type

Views

107

Likes

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

How to resize the image size by percentage ?

Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

DEAL ALL,

GREETINGS!

 

I'm facing a small problem. There is aproject i'm developing script for. Anyhow, the designers asked me somthing and since I'm not a designr, so I don't have a clue how to do it from the UI so i can understand how to do it wit script.

 

So, they asked me to decrese the size of image to make it 30% because the current size is 50%. It's applicable with code? i dont even changed the size of image! i Just place the image and use the fit functons to make it smaller and better, check my code, below:

var doc = app.documents.add()
			
			var image = File.openDialog("Please try to select the icons folder");
		
			
			var rect1 = doc.pages[0].textFrames.add({
				geometricBounds:  [12.7, 12.7, 90, 90]
			});

			rect1.place(image)
			rect1.fit(FitOptions.PROPORTIONALLY)
			rect1.fit(FitOptions.FRAME_TO_CONTENT)

			app.activeWindow.viewDisplaySetting = ViewDisplaySettings.HIGH_QUALITY;

However, is it possiable to decrease the image size by percentege? and how?

I'm using JS.

Thanks all.

I think it's enough to change frame size.
90 - 12.7 = 77.3
but it's only 50℅ ...
ok! 77.3 * 2 = 154.6
we need 30℅, i.e.
154.6 * 30 / 100 = 46.38 + 12.7 = 59.08
and now we can write:
geometricBounds: [12.7, 12.7, 59.08, 59.08]

 

TOPICS
Activation billing and install, Bug, EPUB, Feature request, How to, Import and export, InCopy workflow, Performance, Print, Publish online, Scripting, SDK, Server developers, Sync and storage, Type

Views

108

Likes

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
Sep 08, 2020 0
Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

You can reduce the page size by a percentage, manually, in the Adjust Layout feature.

Likes

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
Reply
Loading...
Sep 08, 2020 0
Advisor ,
Sep 08, 2020

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Sep 08, 2020 0
Participant ,
Sep 09, 2020

Copy link to clipboard

Copied

Thanks!

Likes

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
Reply
Loading...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

You can scale either the image or its parent frame using the absoluteHorizontalScale and absoluteVerticalScale properties. This scales the image.

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Image.html

 

 


var doc = app.documents.add()
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
			
var image = File.openDialog("Please try to select the icons folder");
var rect1 = doc.pages[0].rectangles.add({geometricBounds:  [12.7, 12.7, 90, 90]});

rect1.place(image);
rect1.images[0].absoluteHorizontalScale = 30;
rect1.images[0].absoluteVerticalScale = 30;
app.activeWindow.viewDisplaySetting = ViewDisplaySettings.HIGH_QUALITY;

 

 

Likes

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
Reply
Loading...
Sep 08, 2020 0
Participant ,
Sep 09, 2020

Copy link to clipboard

Copied

Thanks for sharing with me your work, I've tried it, but since we have many images so the size will vary, so some image worked and the others alert me that the value "30" would cause one or more object to leave  the pasteborder. Anyhow, thanks for you time and suport.

Likes

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
Reply
Loading...
Sep 09, 2020 0
Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

I think it's enough to change frame size.
90 - 12.7 = 77.3
but it's only 50℅ ...
ok! 77.3 * 2 = 154.6
we need 30℅, i.e.
154.6 * 30 / 100 = 46.38 + 12.7 = 59.08
and now we can write:
geometricBounds: [12.7, 12.7, 59.08, 59.08]

 

Likes

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
Reply
Loading...
Sep 08, 2020 1
Participant ,
Sep 09, 2020

Copy link to clipboard

Copied

Thanks! The calcultion, worked fine and decresed the size of image, because i changed the frame size. Thanks so much

Likes

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
Reply
Loading...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

I think you have to consider the actual dimensions of the placed image, and if you want to keep the bounds of the .rect1 frame unchanged.

 

For example here are two cases: on the left the image’s actual dimensions are 18" x 24", and when it is scaled by 30% centered, it fits in the frame. The version on the right has a starting image dimension of 5" x 7", and when it is scaled by 30% it is smaller than the frame—in this case you could fit the frame to the image, but that would change the bounds of the original rectangle.

 

Screen Shot 8.png

 

To place centered you can set the transform reference point with this:

 

 

app.layoutWindows[0].transformReferencePoint = AnchorPoint.CENTER_ANCHOR;

 

 

Likes

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
Reply
Loading...
Sep 08, 2020 0