Results 1 to 9 of 9

Resizing Pictures From VBA

  1. #1
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270

    Resizing Pictures From VBA

    Hello All,



    I crossposted it to UtterAccesForums as well.


    Does anyone know a method to resize external pictures (mainly jpg, png) using VBA?
    In one of my projects I need to store pictures for inspections. Button click opens FileDialog, user searches for file which is then copied to specific folder and path to it is stored in db. What I want to do is: before copying it to db folder I'd like to check if it's longer dimension exceed some set size (let's say 2500px) and if it does, reduce longer edge to 2500px keeping proportions of course and save new file as jpg in desired folder.
    Anyone has some proven methods to do this kind of stuff?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,698
    Have you trie setting the image box property to ZOOM?

  3. #3
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    I need to resize file dimesions, not image size on form.

  4. #4
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,698
    That's a different app.

  5. #5
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    And no way to do it via vba? Some external dlls, shell, whatever?

  6. #6
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,698

  7. #7
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Thanks ranman, looks promising.
    Now I need too find method to check file sizes (in pixels) before resizing, to process only ones bigger than 2500px.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,288
    There is a solution by Emilio Sancha to this thread in the UtterAccess forum.

    I have tested it with a jpg and can confirm that it does work.
    In addition, although it says you need a reference to Microsoft Windows Image Acquisition Library vX.X, I have found info that says this is not needed for Vista and above - it is included with the operating systems. I have Windows 8.1 and did not need the reference.

  9. #9
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Thanks orange, I've seen that, will test it today. And if it doesn't need that reference that's even better

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Resizing Forms
    By Lou_Reed in forum Access
    Replies: 12
    Last Post: 01-21-2016, 10:40 AM
  2. Resizing forms
    By Lukael in forum Forms
    Replies: 10
    Last Post: 11-11-2015, 12:53 PM
  3. Resizing when there isn't an image
    By svantred in forum Reports
    Replies: 1
    Last Post: 08-07-2013, 03:10 PM
  4. Resizing
    By AccessIgnorant in forum Forms
    Replies: 2
    Last Post: 12-13-2011, 10:59 AM
  5. Resizing forms
    By wacky1 in forum Access
    Replies: 1
    Last Post: 01-22-2010, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums