ScriptSpot

Forum topic · General Scripting

Script to find the dimensions of an image

By scottparris · 2014-09-16

Description

Is this even possible?

Browse to a folder, find the one jpg image inside the folder, and set the render output size to match the photo dimensions.

Then assign that jpg image to material slot #23 and # 24.

Thanks

Comments (4)

scottparris · 2014-09-16

Thank you! Works perfectly.

scottparris · 2014-09-16

That's awesome!

Thank you, but is there any way to assign the jpg as a bitmap texture and not assigned to the diffuse slot inside a standard material? I'm using the bitmap as an environment background and not a scene material.

Thank you!

.

miauu · 2014-09-16

Run the script.
Select the jpg file.


(
	jpgFilePath = getOpenFileName types:"JPG(*.jpg)|*.jpg|All|*.*|"
	jpgInfo = getBitmapInfo jpgFilePath
	
	renderWidth = jpgInfo[3]
	renderHeight = jpgInfo[4]
	
	mat = standard diffuseMap:(Bitmaptexture fileName:jpgFilePath) showInViewport:true
	meditmaterials[23] = meditmaterials[24] = mat
)

barigazy · 2014-09-16

Yes U can

meditmaterials[23] = meditmaterials[24] = environmentmap = (Bitmaptexture fileName:jpgFilePath)