This project is read-only.

Image Editor

Jul 8, 2010 at 11:01 AM


I just want to start by saying thank you for such an amazing solution. I was having difficulty trying to use twain, and this code has helped me start and progress quite nicely.

In your code that we can download there is the Image editor and associated control. I am wanting to make something similar, and wondered if you could expain how this form worked and a bit about the custom control you made.

Ideally what I am planning on doing is to add the ability to highlight the scanned documents and add text notes, and wondered if you knew how this is possible and point me in the direction that I need to go.

Thanks again


Jul 12, 2010 at 12:16 PM

how the image editor works... you know thats a pretty decent question that I don't remember the answer to off the top of my head.  I'll go back through the code and try to remember what i was thinking back then.  Where there some specific question on the image control?

then adding notes.  tricky, depending on how or where you want the notes stored, are you thinking the notes would become a part of the file?  If the notes are going to become a part of the file are the notes going to be edited afterward or are you thinking that you'll just overlay some text on the image itself?  give me a little more detail on how you image the notes working and I'll think a little about how I would do it.  Off the top of my head I would probably lean toward pdf, where the images were added to a pdf and then some pdf text was added.  I think toward pdf because you get compression for free and the notes could reside in the file with the image non-destructively (without loosing the bit of the image under the text ).  Send some thoughts and I'll review the image control.

Jul 13, 2010 at 10:45 PM
Hi Gaccettola, Well I have stated to work on this and have some ideas. I followed through your code for your image editor form in the open twain project, and have been able to implement the loading of a tiff file into a panel and zoom in and out. Ideally I want to be able to open a Tiff file (which is the imaging standard that i want to use), and then be able to zoom in, out, scroll etc... Then be able to click a button on a toolbar, and then use the mouse to draw a box around part of the image, and when i release the mouse, that area is highlighted. This highlighting needs to be moveable and eventually i would like to be able to adjust their size (using a mouse). On my test form, I created a custom class that inherits the usercontrol class, and then overridden the OnPaint method to set its background color to argb(125,255,255,0). Then I add these to the panel dynamically when i want. What do you think of these ideas; can you think of any improvement?? When it comes to storing these highlight, ideally I want to be able to store the within the image itself, maybe using tiff tags, however I do not want them to become part of the image layer itself. In the grand scheme of things I plan to be able to open a tiff file that i have highlighted and then have program add the highlights in the correct locations and then be able to edit them etc... Thanks for the help and advice James
Nov 3, 2010 at 7:03 PM

In the grand scheme of things when I think of the highlighted areas you're really only going to be able to see these highlighted area in your program right?  Seems that without a standard for having extra data, highlighting or whatever, and not displaying this extra data on the image layer it is just your program that knows about this highlighted area.  Then for all intents and purposes you could store the highlight coordinates anywhere, in a database, in a file next to the image in the same folder, anywhere.  Plus yo may find that for some types of documents you may want to have a 'set' of highlights, like a template, to apply to other documents of the same type.  This leads me into thinking that a database would be best.  Then you take this a little further and you can have all sorts of markup for documents stored in the database.  ANd your files remain compatible with everything under the sun as you haven't really done anything to the image.

The other alternative is to build an image/file container format.  Embed your regular native image into a zip, then add some markup files to the zip to store you highlight, text or whatever and rename the zip to .james or something.  Your program knows how to open the zip files that have been renamed to .james and knows what other files to expect in there. At that point your program can import tiff, pdf, etc into the .james format and the .james files can be EASily opened with *zip to get the original file.  Oh and if you use zip you get a little extra compression.