Solved

automated image resizing of the contents of a windows folder

Posted on 2011-02-26
10
233 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
Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

 

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

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

15 Experts available now in Live!

Get 1:1 Help Now