Home · Register · Search · View Winners · Software · Hosting · Software · Join Upload & Sell

My posts · My subscriptions
  

  Previous versions of Mr Mouse's message #11221849 « Converting 3.2 aspect ratio to 4;3 with horizontal bands. »

  

Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html

If you know Photoshop scripting it would be an easy script to write that would add canvas to make the image be on a 4:3 landscape canvas, All the script need to do is retrieve the images width and height in pixels and compare it aspect ratio to the 4:3 landscape aspect ratio. If the images aspect ratio is wider the document's width is correct all the script need do is add pixels to the document's height. It the images aspect ratio is narrower then the Landscape 4:3 aspect ratio the document's height is correct all the scrip need do is to add pixels to the document's width. If the images aspect ratio is 4:3 all the script needs to do is exit. When the script add canvas to the height or width it can distribute the pixel so there are two borders on the left and right or Top and bottom. Or it can add the needed canvas to just one of the images four sides.

Here is a Photoshop script that should do the canvas add. Record it in an action and use menu File>Automate>Batch.. to batch process images.

/* ==========================================================
// 2012 John J. McAssey (JJMack)
// ======================================================= */

// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.

/* Help Category note tag menu can be used to place script in automate menu
<javascriptresource>
<about>$$$/JavaScripts/CanvasAR4x3/About=JJMack's CanvasAR4x3 .^r^rCopyright 2012 Mouseprints.^r^rScript^rNext Line!</about>
<category>JJMack's Script</category>
</javascriptresource>
*/

// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

// ensure at least one document open
if (!documents.length) alert('There are no documents open.', 'No Document');
else {
// declare Global variables

main(); // at least one document exists proceed
}
///////////////////////////////////////////////////////////////////////////////
// main function //
///////////////////////////////////////////////////////////////////////////////
function main() {
// declare local variables
var orig_ruler_units = app.preferences.rulerUnits;
var orig_type_units = app.preferences.typeUnits;
var orig_display_dialogs = app.displayDialogs;
app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS
app.preferences.typeUnits = TypeUnits.POINTS; // Set Type units to POINTS
app.displayDialogs = DialogModes.NO; // Set Dialogs off
try { code(); }
// display error message if something goes wrong
catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }
app.displayDialogs = orig_display_dialogs; // Reset display dialogs
app.preferences.typeUnits = orig_type_units; // Reset ruler units to original settings
app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings
}
///////////////////////////////////////////////////////////////////////////////
// main function end //
///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////
// The real code is embedded into this function so that at any point it can return //
// to the main line function to let it restore users edit environment and end //
/////////////////////////////////////////////////////////////////////////////////////
function code() {
var canvasWidthAspect=4;
var canvasHeightAspect=3;
var imageWidthAspect=activeDocument.width.value;
var imageHeightAspect=activeDocument.height.value;
var canvasAR=canvasWidthAspect/canvasHeightAspect;
var imageAR=imageWidthAspect/imageHeightAspect;
if (imageAR==canvasAR) {return;}
else {
if (imageAR>canvasAR) {app.activeDocument.resizeCanvas(imageWidthAspect,imageWidthAspect/4*3,AnchorPosition.MIDDLECENTER);} //Add canvas to the height
else {app.activeDocument.resizeCanvas(imageHeightAspect/3*4,imageHeightAspect,AnchorPosition.MIDDLECENTER);} //Add canvas to the width
}
}
//Note the math should be done using the vars and not the hard coded 4 and 3 use here so the line fits in the append
//////////////////////////////////////////////////////////////////////////////////
// Helper Functions //
//////////////////////////////////////////////////////////////////////////////////



Dec 28, 2012 at 03:44 PM
Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html

If you know Photoshop scripting it would be an easy script to write that would add canvas to make the image be on a 4:3 landscape canvas, All the script need to do is retrieve the images width and height in pixels and compare it aspect ratio to the 4:3 landscape aspect ratio. If the images aspect ratio is wider the document's width is correct all the script need do is add pixels to the document's height. It the images aspect ratio is narrower then the Landscape 4:3 aspect ratio the document's height is correct all the scrip need do is to add pixels to the document's width. If the images aspect ratio is 4:3 all the script needs to do is exit. When the script add canvas to the height or width it can distribute the pixel so there are two borders on the left and right or Top and bottom. Or it can add the needed canvas to just one of the images four sides.

Here is a Photoshop script that should do the canvas add. Record it in an action and use menu File>Automate>Batch.. to batcg process images.

/* ==========================================================
// 2012 John J. McAssey (JJMack)
// ======================================================= */

// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.

/* Help Category note tag menu can be used to place script in automate menu
<javascriptresource>
<about>$$$/JavaScripts/CanvasAR4x3/About=JJMack's CanvasAR4x3 .^r^rCopyright 2012 Mouseprints.^r^rScript^rNext Line!</about>
<category>JJMack's Script</category>
</javascriptresource>
*/

// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

// ensure at least one document open
if (!documents.length) alert('There are no documents open.', 'No Document');
else {
// declare Global variables

main(); // at least one document exists proceed
}
///////////////////////////////////////////////////////////////////////////////
// main function //
///////////////////////////////////////////////////////////////////////////////
function main() {
// declare local variables
var orig_ruler_units = app.preferences.rulerUnits;
var orig_type_units = app.preferences.typeUnits;
var orig_display_dialogs = app.displayDialogs;
app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS
app.preferences.typeUnits = TypeUnits.POINTS; // Set Type units to POINTS
app.displayDialogs = DialogModes.NO; // Set Dialogs off
try { code(); }
// display error message if something goes wrong
catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }
app.displayDialogs = orig_display_dialogs; // Reset display dialogs
app.preferences.typeUnits = orig_type_units; // Reset ruler units to original settings
app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings
}
///////////////////////////////////////////////////////////////////////////////
// main function end //
///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////
// The real code is embedded into this function so that at any point it can return //
// to the main line function to let it restore users edit environment and end //
/////////////////////////////////////////////////////////////////////////////////////
function code() {
var canvasWidthAspect=4;
var canvasHeightAspect=3;
var imageWidthAspect=activeDocument.width.value;
var imageHeightAspect=activeDocument.height.value;
var canvasAR=canvasWidthAspect/canvasHeightAspect;
var imageAR=imageWidthAspect/imageHeightAspect;
if (imageAR==canvasAR) {return;}
else {
if (imageAR>canvasAR) {app.activeDocument.resizeCanvas(imageWidthAspect,imageWidthAspect/4*3,AnchorPosition.MIDDLECENTER);} //Add canvas to the height
else {app.activeDocument.resizeCanvas(imageHeightAspect/3*4,imageHeightAspect,AnchorPosition.MIDDLECENTER);} //Add canvas to the width
}
}
//Note the math should be done using the vars and not the hard coded 4 and 3 use here so the line fits in the //append
//////////////////////////////////////////////////////////////////////////////////
// Helper Functions //
//////////////////////////////////////////////////////////////////////////////////



Dec 28, 2012 at 01:00 PM
Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html

If you know Photoshop scripting it would be an easy script to write that would add canvas to make the image be on a 4:3 landscape canvas, All the script need to do is retrieve the images width and height in pixels and compare it aspect ratio to the 4:3 landscape aspect ratio. If the images aspect ratio is wider the document's width is correct all the script need do is add pixels to the document's height. It the images aspect ratio is narrower then the Landscape 4:3 aspect ratio the document's height is correct all the scrip need do is to add pixels to the document's width. If the images aspect ratio is 4:3 all the script needs to do is exit. When the script add canvas to the height or width it can distribute the pixel so there are two borders on the left and right or Top and bottom. Or it can add the needed canvas to just one of the images four sides.

Here is a Photoshop script that should do the canvas add. Record it in an action and use menu File>Automate>Batch.. to batcg process images.

/* ==========================================================
// 2012 John J. McAssey (JJMack)
// ======================================================= */

// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.

/* Help Category note tag menu can be used to place script in automate menu
<javascriptresource>
<about>$$$/JavaScripts/CanvasAR4x3/About=JJMack's CanvasAR4x3 .^r^rCopyright 2012 Mouseprints.^r^rScript^rNext Line!</about>
<category>JJMack's Script</category>
</javascriptresource>
*/

// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

// ensure at least one document open
if (!documents.length) alert('There are no documents open.', 'No Document');
else {
// declare Global variables

main(); // at least one document exists proceed
}
///////////////////////////////////////////////////////////////////////////////
// main function //
///////////////////////////////////////////////////////////////////////////////
function main() {
// declare local variables
var orig_ruler_units = app.preferences.rulerUnits;
var orig_type_units = app.preferences.typeUnits;
var orig_display_dialogs = app.displayDialogs;
app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS
app.preferences.typeUnits = TypeUnits.POINTS; // Set Type units to POINTS
app.displayDialogs = DialogModes.NO; // Set Dialogs off
try { code(); }
// display error message if something goes wrong
catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }
app.displayDialogs = orig_display_dialogs; // Reset display dialogs
app.preferences.typeUnits = orig_type_units; // Reset ruler units to original settings
app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings
}
///////////////////////////////////////////////////////////////////////////////
// main function end //
///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////
// The real code is embedded into this function so that at any point it can return //
// to the main line function to let it restore users edit environment and end //
/////////////////////////////////////////////////////////////////////////////////////
function code() {
var canvasWidthAspect=4;
var canvasHeightAspect=3;
var imageWidthAspect=activeDocument.width.value;
var imageHeightAspect=activeDocument.height.value;
var canvasAR=canvasWidthAspect/canvasHeightAspect;
var imageAR=imageWidthAspect/imageHeightAspect;
if (imageAR==canvasAR) {return;}
else {
if (imageAR>canvasAR) {app.activeDocument.resizeCanvas(imageWidthAspect,imageWidthAspect/4*3,AnchorPosition.MIDDLECENTER);} //Add canvas to the canvas height
else {app.activeDocument.resizeCanvas(imageHeightAspect/3*4,imageHeightAspect,AnchorPosition.MIDDLECENTER);} //Add canvas to the canvas width
}
}
//Note the math should be done using the vars and not the hard coded 4 and 3 use here so the line fits in the //append
//////////////////////////////////////////////////////////////////////////////////
// Helper Functions //
//////////////////////////////////////////////////////////////////////////////////



Dec 28, 2012 at 12:59 PM
Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html

If you know Photoshop scripting it would be an easy script to write that would add canvas to make the image be on a 4:3 landscape canvas, All the script need to do is retrieve the images width and height in pixels and compare it aspect ratio to the 4:3 landscape aspect ratio. If the images aspect ratio is wider the document's width is correct all the script need do is add pixels to the document's height. It the images aspect ratio is narrower then the Landscape 4:3 aspect ratio the document's height is correct all the scrip need do is to add pixels to the document's width. If the images aspect ratio is 4:3 all the script needs to do is exit. When the script add canvas to the height or width it can distribute the pixel so there are two borders on the left and right or Top and bottom. Or it can add the needed canvas to just one of the images four sides.

Here is a Photoshop script that should do the canvas add. Record it in an action and use menu File>Automate>Batch.. to batcg process images.

/* ==========================================================
// 2012 John J. McAssey (JJMack)
// ======================================================= */

// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.

/* Help Category note tag menu can be used to place script in automate menu
<javascriptresource>
<about>$$$/JavaScripts/CanvasAR4x3/About=JJMack's CanvasAR4x3 .^r^rCopyright 2012 Mouseprints.^r^rScript^rNext Line!</about>
<category>JJMack's Script</category>
</javascriptresource>
*/

// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events
app.bringToFront();

// ensure at least one document open
if (!documents.length) alert('There are no documents open.', 'No Document');
else {
// declare Global variables

main(); // at least one document exists proceed
}
///////////////////////////////////////////////////////////////////////////////
// main function //
///////////////////////////////////////////////////////////////////////////////
function main() {
// declare local variables
var orig_ruler_units = app.preferences.rulerUnits;
var orig_type_units = app.preferences.typeUnits;
var orig_display_dialogs = app.displayDialogs;
app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS
app.preferences.typeUnits = TypeUnits.POINTS; // Set Type units to POINTS
app.displayDialogs = DialogModes.NO; // Set Dialogs off
try { code(); }
// display error message if something goes wrong
catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }
app.displayDialogs = orig_display_dialogs; // Reset display dialogs
app.preferences.typeUnits = orig_type_units; // Reset ruler units to original settings
app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings
}
///////////////////////////////////////////////////////////////////////////////
// main function end //
///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////
// The real code is embedded into this function so that at any point it can return //
// to the main line function to let it restore users edit environment and end //
/////////////////////////////////////////////////////////////////////////////////////
function code() {
var canvasWidthAspect=4;
var canvasHeightAspect=3;
var imageWidthAspect=activeDocument.width.value;
var imageHeightAspect=activeDocument.height.value;
var canvasAR=canvasWidthAspect/canvasHeightAspect;
var imageAR=imageWidthAspect/imageHeightAspect;
if (imageAR==canvasAR) {return;}
else {
if (imageAR>canvasAR) {app.activeDocument.resizeCanvas(imageWidthAspect,imageWidthAspect/4*3,AnchorPosition.MIDDLECENTER);} //Add canvas to the canvas height
else {app.activeDocument.resizeCanvas(imageHeightAspect/3*4,imageHeightAspect,AnchorPosition.MIDDLECENTER);} //Add canvas to the canvas width
}
}

//////////////////////////////////////////////////////////////////////////////////
// Helper Functions //
//////////////////////////////////////////////////////////////////////////////////



Dec 28, 2012 at 12:53 PM
Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html

If you know Photoshop scripting it would be an easy script to write that would add canvas to make the image be on a 4:3 landscape canvas, All the script need to do is retrieve the images width and height in pixels and compare it aspect ratio to the 4:3 landscape aspect ratio. If the images aspect ratio is wider the document's width is correct all the script need do is add pixels to the document's height. It the images aspect ratio is narrower then the Landscape 4:3 aspect ratio the document's height is correct all the scrip need do is to add pixels to the document's width. If the images aspect ratio is 4:3 all the script needs to do is exit. When the script add canvas to the height or width it can distribute the pixel so there are two borders on the left and right or Top and bottom. Or it can add the needed canvas to just one of the images four sides.



Dec 28, 2012 at 07:17 AM
Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html

If you know Photoshop scripting it would be an easy script to write that would add canvas to make the be on a 4:3 landscape canvas, All the script need to do is retrieve the images width and height in pixels and compare it aspect ratio to the 4:3 landscape aspect ratio. If the images aspect ratio is wider the document's width is correct all the script need do is add pixels to the document's height. It the images aspect ratio is narrower then the Landscape 4:3 aspect ratio the document's height is correct all the scrip need do is to add pixels to the document's width. If the images aspect ratio is 4:3 all the script needs to do is exit. When the script add canvas to the height or width it can distribute the pixel so there are two borders on the left and right or Top and bottom. Or it can add the needed canvas to just one of the images four sides.



Dec 28, 2012 at 07:15 AM
Mr Mouse
Offline
Upload & Sell: Off
Re: Converting 3.2 aspect ratio to 4;3 with horizontal bands.


If all images are from the same camera and have the same number of pixels. It is very easy to do using Photoshop and an action that uses a script to rotate all images to a known orientation then use Canvas size to add canvas to make the image have a 4:3 aspect ratio. All image will have canvas added to the left and right sides or top and bottom. There is a script in my crafting actions package the will rotate image that need to be rotated then after the canvas size change using the script again will rotate the images that were rotated back to their original orientation.
My free Photoshop packages can be downloaded from http://www.mouseprints.net/Photoshop.html



Dec 28, 2012 at 03:26 AM



  Previous versions of Mr Mouse's message #11221849 « Converting 3.2 aspect ratio to 4;3 with horizontal bands. »