Resize by KB

Corel Paint Shop Pro

Moderator: Kathy_9

okyou
Posts: 193
Joined: Fri Apr 26, 2013 6:52 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16GB
Video Card: onboard
sound_card: onboard
Hard_Drive_Capacity: 2TB
Corel programs: X9 Ultimate

Resize by KB

Post by okyou »

Hello,

I have a file that contain around 300 photo with different size from 221 KB to 28,000 KB that I would like to resize them batch to no more than 800 KB. In other words, those under 800 KB won't need to be processed and the rest to be resized to close to 800 KB. However, there is no size selection in the resize option in batch. Manually adjusting by any of the 4 methods for each photo would take a very long time. Does anyone has any better idea, tricks, and tips to make this manually process less painful ?

Much appreciate for any help.
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 by KB

Post by LeviFiction »

Learn scripting. I don't know how well you can predict file size after a resize, but you can resize, save, check size and repeat until you get the size you want. Maybe decreasing the size by 10% before each save. And repeating.
https://levifiction.wordpress.com/
okyou
Posts: 193
Joined: Fri Apr 26, 2013 6:52 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16GB
Video Card: onboard
sound_card: onboard
Hard_Drive_Capacity: 2TB
Corel programs: X9 Ultimate

Re: Resize by KB

Post by okyou »

Thanks for your information. If all my photo is the same size then it would be easy to resize them by setting the percentage once as you mentioned and all done. The problem is all the photo are all in different size. For example, if I set the percentage to 10%, Then a file of 900 kb may become 810 but a 9000 kb photo will only become 8100 kb which is far from my objective of 800 kb.
okyou
Posts: 193
Joined: Fri Apr 26, 2013 6:52 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16GB
Video Card: onboard
sound_card: onboard
Hard_Drive_Capacity: 2TB
Corel programs: X9 Ultimate

Re: Resize by KB

Post by okyou »

Besides, the percentage only represent width x height, not the actual image size.
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 by KB

Post by LeviFiction »

Yes I am aware. xD The two biggest things that will result in a change in data size is either a reduction in pixels, or a reduction in quality. And since I assumed you didn't want to take a photo and essentially convert it into a blocky mess I figure reducing the number of pixels might be best.

I ran a few small tests to see if I could find any obvious solution. And I could not, naturlally with all images being different the same edit resulted in different amounts of resizing.. For example, when I load up a 4MB file and go to Save As with a JPG setting of 20 it shrinks almost by 50% to 2.210MB. While a 1.08MB file was reduced to about 33% down to 374.8KB. So no way of determining how PSP will shrink the file on the first save without changes.

I then resized the images by 10% each, the 4MB file became 1.699MB which is 75% of the 2.210MB size of the initial size. The 1.08MB file became 333KB which is .89 % of the intial size so far closer to only going down by 10%.

So what I'm proposing is determine the JPG settings you want to save with. Put those into a script that reads in files from a folder, loads them up, saves the out with these settings, if that is sufficient to bring them down to 800K then stop. If not, then reduce the image size by 10% and save again, check size. If it's still too large reduce again and save an check again. It'll be a little slow, but it'll be automated.
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 by KB

Post by hartpaul »

There are too many variables in your question to provide an answer. Are your images jpgs, bmps, tifs ? This is important as the image type affects the size greatly. eg I set up an 8000 x 8000 image with a multicolor gradient and saved it as each of those file types.
.bmp 187 501KB
.tif 5 626 KB
.jpg at 1% compression 5 575 KB
.jpg at 10 % compression 2 468 KB

None of these were anywhere near your 28 000 KB image so I am wondering what pixel dimensions you have there.

To reduce overlarge images to 800 KB or less requires knowing what size (pixel dimensions) , what image type, and if jpg, what compression.
As well as knowing these I would need to know if you want the images resized to reduce KB by changing pixel dimensions, or compression (jpg) .

It is easy enough to make all images the same pixel size based on the longest side. (change in pixel dimensions) .
It is easy to make all images the same compression.
If you are happy enough to have the images changed in pixel size then one way would be
1 . Load up your image that is 22000 KB and resize this using a % eg 70%.
2. Do a Save as and change the compression to your preferred value say 10%
3. Look at the bottom to see the file size . If the file size is too big then cancel the save and go back and undo the size change.
4. Change the % to lower eg 65% - you will get a better idea of what you need to do as you use trial and error to get the resizing done.
5. Now if you use that % for all your images then they will all be resized so that they are still in the same proportion to one another. I gather this is still not what you want as you havs sstated that you will not want to process images that are already 800 KB or below.

I think you will need to separate your images in proportion to their sizes. In windows explorer you can sort the images by size by clicking on the Size title.
You can then copy all the images that are greater than 800 KB to a separate desktop folder. You might also like to further separate these into separate sub folders >800-<2000KB, >2000 -4000KB , >4000KB - <8000 KB >8000 - <16000 KB . and >16000KB.
You can then apply a batch resize based on % to each of these folders . You might use 10% for the largest >16000, 30% for >8000 -<16000, up to 70% for >800-<2000KB.

It involves a bit more work but will allow partial batch processing to give you images that are all around 800 KB or less.
Systems available Win7, Win 8.1,Win 10 Version 1607 Build 14393.2007 & version 20H2 Build 19042.867
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Resize by KB

Post by Jean-Luc »

The "Compress to Target size" script from Suz Shook seems to do what you want.
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2019, 32 & 64-bit
Location: Canada

Re: Resize by KB

Post by JoeB »

Jean-Luc wrote:The "Compress to Target size" script from Suz Shook seems to do what you want.
If that script does, in fact, do what the OP needs done, then it is available here, with instructions:

http://suzsplace.com/8scripts/ss-Compre ... etSize.htm
Regards,

JoeB
Using PSP 2019 64bit
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 by KB

Post by LeviFiction »

I did not know about that script, thanks Jean-Luc. Looking at it, she seems to use the same general idea, make some sort of edit (in her case the compression setting) save it out and check the size, if it's not small enough, save at a smaller size, continue until you've gone too far with no success, or until you're below the target.

Do want to be careful with that though, compress too far and the result may not be worth the time and hassle. :P And her script allows the compression to get as high as 99 before giving up.
https://levifiction.wordpress.com/
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Resize by KB

Post by Jean-Luc »

LeviFiction wrote: And her script allows the compression to get as high as 99 before giving up.
Glups !
:shock:
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
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 by KB

Post by hartpaul »

I suspect that any script that is given free rein with the compression will give unsatisfactory results.
What would be the ideal would be to set a range for the compression eg 1 to about 25 , (0r 1 to 80 - whatever amount of compression you can put up with ) and when you get to that limit without success, then revert to actual resizing of pixel dimensions for the rest.
So for any under your limit of 800KB no change, then part 2 save all with your maximum allowed compression, then step 3 any images still outside the 800KB limit do physical resizing til they are within the limit.
There is no way a 28000 Kb image is going to get to 800 KB without much compression and resizing. A 28 MB image is huge if a jpg. To get 28468 KB I had to have an image that was 11232 x 7488 . It would appear that the OP's folder contains images with a large range of sizes, from 1100 pixels longest side to 11000 pixels.
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 by KB

Post by LeviFiction »

Yup, already working on that very process. xD Here's how I'm thinking of doing it.

Open any image, and the folder location of that image will be batch processed. It'll ask for a maximum compression, target size in KB, and a minimum long side size. Then for all images in the folder it builds a list of all images that are larger than your your target. So we make processing faster by immediately ignoring all irrelevant images.

Then we perform three fast checks. 1) Saving with maximum compression allowed if still too big 2) Saving with maximum compression allowed at minimum width and height, if still too big we give up. If small enough 3) we try saving at 1 compression and minimum width and height. If still okay size-wise, and greater than 10% of the target we begin the longer process of back and forth changes on width and height. If it's not good at 1 compression point then we find the first compression point between 1 and 25 at this new height that gets us outside 10% of the target on the low end. Then we move on to the resize attempts.

We undo the resize and we calculate the new size percentage and we do half of the percentage difference and we try that. If it's too big, we go down by another half of the percentage, and so on. Every time we get below the target but are higher than the last target, we save that value, and we keep trying until we're doing only 1% at a time getting the closest size and compression mixture.

This makes the script slow on challenging images, but hopefully fast on simple images.

But that's just the idea in my head.
https://levifiction.wordpress.com/
MarkZ
Posts: 1080
Joined: Sat Feb 05, 2011 10:41 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Intel DQ67SW desktop
processor: Intel Core i7 i7-2600 3.40 GHz
ram: 8 GB
Hard_Drive_Capacity: 500 GB
Monitor/Display Make & Model: LG Flatron E2241
Corel programs: PSP 2018 X9 X8 X7 X6 ASP3 ASP
Location: Toronto

Re: Resize by KB

Post by MarkZ »

Another thought. Figure out what size an image would have to be to get under 800kB, assuming a standard ratio such as 3x4 or 5x7. In the script check the size of the image (I've worked very little with script and am guessing at what can be done) and if the long side is more than what the user wants, resize the long side the desired value. If smaller, skip to the next. This may require going back to the list of images and redoing those that are too big.
Mark
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 by KB

Post by LeviFiction »

I don't know, that's still far too variable. JPG compression is based highly on the content and variation of the pixels in the image.

For example, I have three images that are 4048x3036 all saved directly from my camera with the same compression level. One is 2MB, one is 4MB and one is 7MB. The one that is is 2MB is 3/4ths sky. So very uniform color for most of the image. The 7MB is a dense forest path with flowers, water, rocks, grass, trees, etc. So it requires more data to save the same number of pixels. The 4MB is just a street in my neighborhood, so lots of areas that are similar in color, but enough variation

ICC profiles and EXIF data tend to take up a few KBs. Not much. like maybe at most 100KB. And that's mostly the ICC profile.

Anyway, when you're talking about two similarly sized images with one being nearly 1/3rd the size of the other. I doubt you're gonna find a viable reference between size and compression ratio to apply wide-scale. If only Corel offered us a tool for this sort of thing. Predicting the output of an image.
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 by KB

Post by hartpaul »

That would be an interesting addition to the Resize dialog box. A slider where you can set the Save compression and a slider for the longest side with an output showing the space taken for those conditions on save, a bit like exists at the bottom of the Save As dialog. Should not be hard to also include that in the Resize dialog. Probably be a one up on Photoshop as well.
I can visualize it as below:
01ResizebyPixels.jpg
02ResizebyPercentage.jpg
03ResizebyPrintSize.jpg
04ResizebyOneSide.jpg
Systems available Win7, Win 8.1,Win 10 Version 1607 Build 14393.2007 & version 20H2 Build 19042.867
Post Reply