Resize script with set width and (aspect ratio) height

Moderator: Kathy_9

Post Reply
MarkCRD
Posts: 2
Joined: Tue Jun 12, 2012 11:20 pm
operating_system: Vista Home Premium
System_Drive: C
32bit or 64bit: 32 Bit

Resize script with set width and (aspect ratio) height

Post by MarkCRD »

Hi,
I am trying to create a script (that I can run on a batch of images) that will resize the images to a set width but will maintain the proper aspect ratio of the images. There are many images and they are all different dimensions.

I want to resize them for webpages to a standard width (300) and have the height be automatically adjusted to the new width (proper aspect ratio).
When I try to create the script, it automatically uses the aspect ratio height of the image that was used to create the script.
When it runs on additional images it automatically sets their height to the height of the first image (used to create the script).
As all of the images have different dimensions, the end result is wrong.

Is there a way to write the script so that it will maintain the proper aspect ratio of multiple images, all with different dimensions?

Thanks.
MarkCRD
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Resize script with set width and (aspect ratio) height

Post by LeviFiction »

Yes it is.

Scripts in PSP are written using the Python programming language which is free and open source with lots of information online for how to use it. Python is used in everything from 3D graphics to scientific calculations, studies, and visuals. It's very easy to use once you get the hang of it.

Suz's place is a good place to learn about advanced scripting as well as providing examples of maintaining the aspect ratio of images.

http://suzsplace.com/8scripts.htm


However, not everyone wants to learn programming to do what they think should be a very easy thing. So I know of two scripts that do what you're looking for:

1) Pixelnook's ResizeToLimit script - http://pixelnook.home.comcast.net/~pixe ... oLimit.htm

2) My own Resizer script - not as pretty and probably not as good as Pixelnook's but early reports from users say it works. It's also a little more awkward to use properly. - http://www.paint-shop-basics.com/resources/resizer
https://levifiction.wordpress.com/
MarkCRD
Posts: 2
Joined: Tue Jun 12, 2012 11:20 pm
operating_system: Vista Home Premium
System_Drive: C
32bit or 64bit: 32 Bit

Re: Resize script with set width and (aspect ratio) height

Post by MarkCRD »

LeviFiction,
Thanks for the quick response!
I downloaded and installed both scripts. Worked perfectly!!!
Thanks very much!
MarkCRD
User avatar
hartpaul
Advisor
Posts: 2893
Joined: Tue Mar 20, 2012 3:38 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK P7P55D STRIX B240F GAMING
processor: IntelCore i7 7700 3.60 Ghz
ram: 8 Gb
Video Card: Nvidia GeForce GTX 1050
sound_card: Nvidia High Definition Audio
Hard_Drive_Capacity: 1000 Gb
Monitor/Display Make & Model: AOC
Corel programs: PSP8,X2 to X9,2018,2019,2020
Location: Australia

Re: Resize script with set width and (aspect ratio) height

Post by hartpaul »

Or you could use a program such as Irfanview which will do all the images whether portrat or landscape in one go without filddling around separating the two types. I use it to resize a mixture of 4500 images + a month and it does a batch process and rename / renumber as separate or combined operations at once.
Systems available Win7, Win 8.1,Win 10 Version 1607 Build 14393.2007 & version 20H2 Build 19042.867
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Resize script with set width and (aspect ratio) height

Post by LeviFiction »

Hartpaul, interesting you should mention. These two scripts also do landscape or portrait without the need to separate them. MarkCRD only asked for the ability to define the width and have the height follow suit which works no matter the image orientation.

If you're talking about longest vs shortest side. My script handles that easily. In fact it was based on IfranView's options.

Of course InfranView is a lot easier to handle settings wise for batch scripting. As soon as I find time to finish my GUI for the script I hope to make it just as easy.
https://levifiction.wordpress.com/
User avatar
hartpaul
Advisor
Posts: 2893
Joined: Tue Mar 20, 2012 3:38 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK P7P55D STRIX B240F GAMING
processor: IntelCore i7 7700 3.60 Ghz
ram: 8 Gb
Video Card: Nvidia GeForce GTX 1050
sound_card: Nvidia High Definition Audio
Hard_Drive_Capacity: 1000 Gb
Monitor/Display Make & Model: AOC
Corel programs: PSP8,X2 to X9,2018,2019,2020
Location: Australia

Re: Resize script with set width and (aspect ratio) height

Post by hartpaul »

Look forward to it. Then the time trials start. :D
Systems available Win7, Win 8.1,Win 10 Version 1607 Build 14393.2007 & version 20H2 Build 19042.867
Post Reply