Photoshop CS2 Image Resize

Hi All!,

Trying to get this to work:


		(* Start Resizeing the image if it is to large it shrinks to 150mm 
		if it is small than 50mm then it adds _small to the filename *)
		
		set docsizelarge to (1772 as pixels) as integer
		set docsizesmall to (591 as pixels) as integer
		
		if docHeight is greater than docsizelarge then
			resize image docRef height 1772 as pixels width (1772 * docWidth / docHeight) as pixels resample method bicubic
		end if
		
		if docHeight is less than docsizesmall then
			set docBaseName to (("_small" as string) & " " & (docBaseName as string))
		end if

But for some unknown reason its not working???

Please Help.

Hi generic

I’m not sure about applying the logic to your script!
But this snippet will resize your image in pixels…

tell application "Adobe Photoshop CS"
	activate
	set docheight to height of document 1
	set docWidth to width of document 1
	set display dialogs to never
	set thisdoc to current document
	tell thisdoc
		resize image width pixels 591.0 height pixels 1772.0 resample method bicubic
	end tell
end tell

A bug was introduced into Photoshop with CS2 and resizing. Did this code work before? I can’t remember exactly what the problems are Im still a CS1 user but think you needed to caluclate size using pixels only. I prefere to set the ruler units to this and don’t quote the units not sure if this would help in your situation.

tell application "Adobe Photoshop CS"
	activate
	set display dialogs to never
	set UserPrefs to properties of settings
	--
	set ruler units of settings to pixel units
	--
	delay 2
	--
	set ruler units of settings to ruler units of UserPrefs
	--
end tell