[AccessD] Resize pictures

Stuart McLachlan stuart at lexacorp.com.pg
Wed Oct 6 01:01:43 CDT 2010


Definitely ImageMagick  www.imagemagick.org/

I'm using it to do this sort of thing regularly form website content generators in Access.  The 
following function takes the name of an image which is currently stored in a "Photos" 
directory located with the back-end database and created a standard sized image in a 
directory called "webphotos".  You can put any appropriate commands in strEffect to 
determine the outcome.   I use a function Shellwait() to make sure that the picture is created 
before the function returns so that further processing (in this case FTP uploading of the 
photo) works.

You can do just about anything with Imagemagick commands, lots of examples at
http://www.imagemagick.org/Usage/

Function CreateWebPic(Image As String) As Boolean
  Dim strConvert As String
  Dim strShell As String
  Dim strWebPic As String
  Dim stroriginal As String
  Dim strEffect As String
  strConvert = """c:\program files\imagemagick-6.5.3-q16\Convert"" "
  strEffect = "  -thumbnail 600x600 "
  stroriginal = """" & BEDir() & "photos\" & Image & """"
  strWebPic = """" & BEDir & "photos\webphotos\" & Image & """" 
  strShell = strConvert & stroriginal & strEffect & strWebPic
  ShellWait strShell, vbHide
End Function

-- 
Stuart


On 6 Oct 2010 at 0:28, Joe O'Connell wrote:

> I am developing an A2003 application for a division of a construction
> company that installs guardrails on highways.  They have long term
> contracts with the Department of Transportation to fix/repair/replace
> guardrails that have been damaged.  Part of the documentation that is
> required is to provide a "before" and an "after" picture for all
> repairs.
> 
> The application lets the user browse the memory card for the pictures
> and then copies them to the computer's disk.  The original size of the
> pictures is 5-6mb.  Not only will a lot of disk space be required to
> store the pictures, but pictures of this size take a lot of time to be
> scaled for forms and reports.  Due to the number of pictures processed
> each day, it is not feasible for the user to manually resize the
> pictures before uploading.   What I would like to do is to resize the
> pictures during this transfer process to about 10% of their original
> size.
> 
> Any suggestions or code snippets to resize the pictures are greatly
> appreciated.
> 
> Joe O'Connell
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 





More information about the AccessD mailing list