User Image Editing within Microsoft Access Database

I want to allow users to be able to manipulate images within Access. I want them to be able to:

Crop: User sets corner points and the image is cropped to those
Sharpen: sliding scale sharpen function (with live preview if possible)
Brightness: sliding scale brightness/contrast (with live preview if possible)

...using something I run from the VBA code. The code will then need to use the same image "package" to resize the images to the final size, crop them if needed and create thumbnails so they can be uploaded with the database to a website.

So to make it clear the user loads an image into the database for a stock item (say) and then is able to crop, brighten and sharpen it from the same form or another pop up form custom designed for the purpose.

I've looked at Imagemajick and FreeImage but I can't see how to get the interactivity going between the form and those packages - particularly for the crop.

Any ideas? I will happily give an A grade for a reasonable answer which heads me in the right direction.
Computer_DiloAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'm not sure if this one will allow editing, but it is certified to work in Access 2007:
http://www.ammara.com/dbpix/access.html

Be careful when using ActiveX controls in Access, especially 2007. Many of them will appear to work fine on your machine, but will not work on other machines, even if those machines appear identical.
Computer_DiloAuthor Commented:
Hmmm. I certainly didn't come across that in my travels but it doesn't allow the things I really need like cropping, sharpening and brightness. It does solve the bloat problem of including pics in the database but then I worked that one out ages ago by just inserting the picture path as text and then showing the picture in a box :)

Thanks anyway!
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'm not sure you'll find much in regard to actual image editing in Access. It's not really a topic that is relevant to the majority of Access database users/developers, therefore there's really not much in place about it. There is very, very little that can be done in VBA with this unless you're willing to delve quite deeply into the API.

What do you need to do with images inside Access? If you're storing the path, you can often use an external editor, which would give you all the features of that editor (and the edited picture would still be available in Access, if you need to display it).
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Andrew_WebsterCommented:
Awesome to see someone pushing it with Access.

I agree with @LMSConsulting.  The best approach is to link to an external file (remember to use UNC paths if on the network), rather than embed the image,  and supply an image editor.  Paint.Net would be the obvious choice as it's free and does everything you need.
Computer_DiloAuthor Commented:
Hmmm - OK. I had though about something like that (kind of giving up on Access though - although it generally deserves to be given up on sometimes!). I'll look at Paint.Net then.

Just out of curiosity is there a way to register the XY position of a mouse click on an image displayed in Access??
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I disagree with you re: "kind of giving up on Access though - although it generally deserves to be given up on sometimes!). " That's sort of like loading two pallets of shingles on your Prius and then complaining that it doesn't work as well as your F350 would! Access is used to build data-centric applications, not image editing software.

The Mouse events should provide the position for you, if I'm not mistaken.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Computer_DiloAuthor Commented:
When you've created a magnificent multilayered query and attached it to a report to have it fail miserably and then, after 5 hours of pounding your head against the screen, got desperate and dumped the same, unaltered query into a table and then attached the table to the report and had the report work perfectly you tend to get a little jaded :)

Yes indeedy - the MouseDown event provides the necessary means to draw a crop box around the image. I've implemented the crop box so far - all I need to do now is to link in something like ImageMajick and translate the top left and bottom right points to image co-ordinates to crop.

So you two experts have certainly helped direct me this far. Any other related suggestions?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Complex multilayered queries + Access report have always = trouble, which is why Access allows subreports (to do away with those multilayerd queries). The Access reporting engine is a good piece of software but it is a bit long in the tooth.

I have no idea how to integrate something like ImageMajick with Access.


Andrew_WebsterCommented:
I'm right there with LSMConsulting.  When it comes to the complex reports thang, five hours is nothing!  A really tough report, I might allow five days to design it, get the mix of complicated queries, subreports, or temporary tables sorted out.  The more you do with Access, the more you end up with in your box of tricks.  Frnakly, I've yet to some across a single package application that's a powerful and versatile.

When it comes to automating ImageMajick, likewise, I've no idea.

Don't think me rude, but what was the requirement for the image editing?  I know I've got sucked into solving a cool problem and prioritized that over actually providing a working solution for the problem in the business requirement.  It can take something to wrench yourself away from a fascinating but actuall indulgent bit of research.

If the business had told you "We must be able to edit and do so from within the application, this is mission critical ad you'll be burned at the stake if you fail" the go for it.  But if the requirement is "All the user to edit the image" then go back to the business and off them a couple of easy options, even if they are workarounds.

I've found that providing a swift solution, if clumsy, for the people who pay me ensures that I get paid a lot more in the long run through repeat business and improved trust, than if I provide a clever solution that's taken a age to produce.
Computer_DiloAuthor Commented:
Wise words Andrew :)

In this case some simple editing would make my application so much more powerful - allowing my Photoshop (or any image package for that matter) ignorant clients to be able to maximise the effectiveness of images they have taken themselves or received from a supplier or collected from the web so they can be used on an online catalog. At present they send all the images to me for processing. By achieving what I am trying to do here I can have an "Update Website" button in Access and know the images they upload will be OK for the job.

This is what I need to do to crop:

* Read the coordinates of a mouse click on an image <done>
* Mark a crop box on the image and record the coordinates of the TL and BR corners <done>
* Get the actual pixel dimensions of the image file <nuts>
* Convert the Access coorniates to the file coordinates <doable>
* Shell a crop command on the file <doable>
* Refresh the image in Access <doable>

I'm pretty much 1 step off now by using clunky shell commands - I just need to either get ImageMagick working in VBA (there are plenty of examples working with Visual Basic but information on actually referencing it in VBA are confusing) or do the process with Shell commands.
Computer_DiloAuthor Commented:
....nuts: anyone know how to read the output of a shell command in VBA????
Andrew_WebsterCommented:
Have you tried declaring a variant
Dim varRetVal as Variant
varRetVal = Shell(blah blah)

I suspect it might fall down if the process being Shelled takes a while as, from memory, VBA treats Shell synchronously, so it might have moved on before a value is returned.

However, I'm not testing this right now, as my wife is cooking sausages, onions, and mash, and that trumps Access any day!  Let us know how it goes.
Computer_DiloAuthor Commented:
Bah :( I was using ShellWait anyway so VBA execution stops and waits for the shell command but it seems Shell just returns an INT as a status rather than the output string of the command.

Still it made me angry enough to work out how to reference the ImageMagick library in Access so I finally managed to do that. Now I should be able to manipulate the images directly in VBA code and save my sanity. I'll report back on how that goes when I get a chance to do it.

Both of you have helped so I'll split points between you if that's OK!?
Andrew_WebsterCommented:
Works for me.  Good luck with the sanity thing!
Computer_DiloAuthor Commented:
The complete solution is a work in progress but these experts helped me get there by eliminating other paths. I will post the solution once I've created and tested it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.