Copy link to clipboard
Copied
Hello, greetings to all!
How to check if a document has the width 21.5 cm in a resolution 200?
If the document has these values all ok, if not, please change.
It would be something like this:
var doc = activeDocument
if(doc.resolution<200){
doc.resizeImage (undefined, undefined, 200, )}
This script alters the resolution however and I need it to change the value of the width "if it does not match" and thus proportionally change width and height at a 200 resolution.
I usually do a sweep here in the community and I'm collecting information and I'm putting together one of the pieces: I found in these discourses something that might help you:
https://forums.adobe.com/message/9050951#9050951
https://forums.adobe.com/message/9463456#9463456
Result:
...var doc = activeDocument
if(doc.resolution<200){
doc.resizeImage (undefined, undefined, 200, )}
if(doc.resolution>200){
doc.resizeImage (undefined, undefined, 200, )}
activeDocument.resizeImage(new UnitVal
Copy link to clipboard
Copied
I usually do a sweep here in the community and I'm collecting information and I'm putting together one of the pieces: I found in these discourses something that might help you:
https://forums.adobe.com/message/9050951#9050951
https://forums.adobe.com/message/9463456#9463456
Result:
var doc = activeDocument
if(doc.resolution<200){
doc.resizeImage (undefined, undefined, 200, )}
if(doc.resolution>200){
doc.resizeImage (undefined, undefined, 200, )}
activeDocument.resizeImage(new UnitValue (210, "mm"), undefined, undefined)
Code as clean as possible:
var doc = activeDocument
if(doc.resolution<200)(doc.resolution>200){
doc.resizeImage (undefined, undefined, 200, )}
doc.resizeImage(new UnitValue (210, "mm"), undefined, undefined)
Copy link to clipboard
Copied
Great! That's what I was looking for. Thank you for your help smithcgl9043167
Copy link to clipboard
Copied
If you set a document resolution to 200 and its width is not 21.5 cm you can interpolate it to 21.5CM and constrain the height to its current aspect ratio. However, whenever you resample an image you will loose some image quality. For your either throwing away details you have for the image or creating detail you do not have for the image. You may want to use a particular interpolation method like bicubic.