Solved

automated image resizing of the contents of a windows folder

Posted on 2011-02-26
10
235 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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
 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

821 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