Solved

automated image resizing of the contents of a windows folder

Posted on 2011-02-26
10
236 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 40

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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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 40

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
 

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 15

Assisted Solution

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
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…

839 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