Solved

automated image resizing of the contents of a windows folder

Posted on 2011-02-26
10
234 Views
Last Modified: 2012-06-27
I have an Access application that imports student's info and a photo that they upload to a website.

This import is automated and the photos are imported into an Attachment field. I'd normally leave them external and just store the path but in this instance this is not practical.

As the file sizes will vary I want to be able to resize all the images to pasport image size before the import.

So what I need is a script or command line driven utility that can resize all of the images in a specified windows directory. I can then shell out to this utility from Access.
0
Comment
Question by:kentgorrell
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 34990053
Why don't you limit the size on upload? If you only take photos on the web site of the proper size, you don't have to do any conversion on the Access side.
0
 

Author Comment

by:kentgorrell
ID: 34990091
That would make it harder for the client trying to join.

My job is to make things easier. Isn't that what software development should be all about?
0
 
LVL 39

Expert Comment

by:als315
ID: 34990403
You will need third party tool, like this:
http://download.cnet.com/Free-Batch-Image-Converter/3000-2084_4-10845423.html
You can run it from Access
0
 

Author Comment

by:kentgorrell
ID: 34993700
Nice tool but currently no support for command line parameters.

I'd still like to find something that requires no user intervention.
0
 
LVL 39

Expert Comment

by:als315
ID: 34995000
As I have mentioned, there is a lot of such tools:
http://www.rw-designer.com/photo-resizer-advanced
with command line
0
Why are Office 365 signatures so complicated?

Trying to setup transport rules for Office 365 email signatures and can’t quite figure it out? Having to test the signature over and over? Make things simple by using Exclaimer Cloud - Signatures for Office 365.

 

Accepted Solution

by:
kentgorrell earned 0 total points
ID: 35160926
In the process of testing applications.
Found one that doesn't cost much and does the job but because it isn't free I can't include it in my installer which makes distribution (even though it's just a few clients) difficult.
So I just need time to try out Advanced Photo resizer
I'll post back after further testing.
0
 
LVL 14

Assisted Solution

by:Giovanni Heward
Giovanni Heward earned 500 total points
ID: 36319876
0
 
LVL 14

Expert Comment

by:Giovanni Heward
ID: 36319926
Here is a script I wrote for a previous project... as-is it reduces the image size to 80%, however you can change the command-line to resize by pixels (for example):

convert -size 525x375 "%%f" "%%f"

Other tweaks will may be needed (various image extensions, for example)

Good luck...



@echo off
:: install http://www.imagemagick.org/download/binaries/ImageMagick-6.7.1-2-Q16-windows-dll.exe
setlocal enabledelayedexpansion
set log="%userprofile%\desktop\output.txt"
call :logit JPEG Compression Script 1.0a by Giovanni Heward started %date% %time%
if not exist "%programfiles%\ImageMagick-6.7.1-2-Q16\convert.exe" (
	call :logit "%programfiles%\ImageMagick-6.7.1-2-Q16\convert.exe" not found, aborting...
	goto :eof
)
if [%1]==[] (set minsize=100000) else (set minsize=%1)

for /f "delims=?" %%f in ('dir *.jpg /s/b') do (
	set bits=%%~zf
	if %%~zf leq !minsize! (
		call :logit Not compressing %%f, less than !minsize! bits ^(!bits!^) 
	) else (
		call :logit Compressing %%f, greater than !minsize! bits ^(!bits!^)
		"%programfiles%\ImageMagick-6.7.1-2-Q16\convert.exe" -compress JPEG -quality 80 "%%f" "%%f"
	)
)
call :logit JPEG Compression Script 1.0a by Giovanni Heward ended %date% %time%
goto :eof

:logit
echo %*&title %*&echo %*>>!log!

Open in new window

0
 

Author Comment

by:kentgorrell
ID: 36320044
This looks good, don't have time to test it all at the moment but, being open source it allows me to distribute it with my application. And that is my main concern in most cases.

So thank you and I'll get back with a comment once I've had a chance to try it out.
0
 

Author Closing Comment

by:kentgorrell
ID: 36367953
Haven't tested yet but it looks like what I need.
0

Featured Post

Are your corporate email signatures appalling?

Is it scary how unprofessional your email signatures look? Do users create their own terrible designs and give themselves stupid job titles? You can make this a lot easier for yourself by choosing an email signature management solution from Exclaimer today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now