Link to home
Start Free TrialLog in
Avatar of Computer_Dilo
Computer_Dilo

asked on

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.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

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.
Avatar of Computer_Dilo
Computer_Dilo

ASKER

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!
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).
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.
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??
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
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.


SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
....nuts: anyone know how to read the output of a shell command in VBA????
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.
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!?
Works for me.  Good luck with the sanity thing!
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.