Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to manipulate images

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi,

We do the following currently:

1. Scan the invoices
2. Save in folder "\GRAPHICS\PRODUCTS" with serial no of the invoice, let say "SI100105"
3. In form I apply the following code in order to display the invoices according to the serial no.

micode = allt(upper(This.value))
mpic = micode+'.jpg'
This.Parent.ItemImage.Picture = '\GRAPHICS\PRODUCTS\&mpic'
If ! File("&mpic")
This.Parent.ItemImage.Picture = '\GRAPHICS\PRODUCTS\no_image.jpg'
Endif

So, it is necessary to save the images exactly with the serial no.

Is it possible if I upload the image in the form, path should be saved somewhere in the table.

In this way the user will be free from saving the file according to the serial no. of the doc.

I hope I delivered what I am looking for.

Thanks!!

Saif
 
Even if you know a picture to show in advance, no picture ever is embedded in a form. So what you do right now already is very sensible as is.

Of course you could save the path '\GRAPHICS\PRODUCTS\&mpic' in some table and then let picture be that table field, but an image control has no control source, you'll always have to set either .Picture to a file name or .Pictureval to FILETOSTR(filename). There is nothing doing a refresh after a SKIP 1 or activating another invoice in a grid or listbox. You always have to set this.

Bye, Olaf.
 
Saif,

I'm not sure I completely understand your question. Are you perhaps asking if you can save the image in a table? I can see why you might want to do that.

It is certainly possible to do that. The table can have a field with a General data type, and you can use APPEND GENERAL to load the image into it.

However, although that is possible, it is not advisable, for various reasons, not least of which is that it can lead to very bloated tables. In fact, your current approach is probably the best way to go about this. Unless I have misunderstood what you are asking, my advice would be to leave things as they are.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mr.Olaf/Mike

So what you do right now already is very sensible as is.

In fact, your current approach is probably the best way to go about this.

My only concern is the user should not give the wrong serial no. in that case wrong doc will be displayed and also the user is using ADF (Auto Document Feeder) in which he scans multiple doc in one click which gives the different image names in a particular folder apart from the serial no. of the doc.

Thanks

Saif
 
Well, the correct assignement has to be made anyway. no matter how the picture is named, that name has to be saved in the invoices table and the invoices table has to have a field for it. Then you still have problems, if the user overwrites a wrongly named file.
If you do the scan in your software, you can provide a default file name. You don't seem to do that and it would be a non trivial task.

Bye, Olaf.
 
My only concern is the user should not give the wrong serial no.

Where do the serial numbers come from? Are they printed on the invoices? If so, then you will always have to rely on the user correctly reading them from the document and entering them into the system. The only other option would be to use OCR to detect the number, but that would not be practical if the invoices are in widely different formats or layouts.

Or are the serial numbers generated by your software? I assume that's not the case, as there would be no need for the users to enter them.

By the way, are these sales invoices or purchase invoices? The difference is that the layout of purchase invoices, and the way in which they are numbered, is outside your control, whereas that's not the case with sales invoices.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Invoice No. is not pre-printed it is generated by the software.

In the light of the above, the conclusion is that we have to emphasis the user to enter the correct serial no.

Thanks

Saif
 
Well, if you generate and know it, you can't autosave it? Preset it as default save name?

Bye, Olaf.
 
No, I am talking about the image name like;
Invoice Serial No. is "SI100010", so the user has to save the image like "SI100010.Jpg".

Thanks

Saif
 
Well, if your software generates both that "SI100010" number and the image you can save as "SI100010.Jpg" with code, not asking the user to specify that name, what's the difficulty to do that?

You said:
alisaif said:
Invoice No. is not pre-printed it is generated by the software.

If your software generates it and prints it you should be able to specify the file name without asking the user. You can print to EMF, PNG, JPG, BMP, GIF, or TIFF with foxypreviewer, not only in interactive preview mode, for example.

If you print and scan invoices to get the picture, think about using your report to generate a picture instead. Options of foxypreviewer allow you to do so non interactive:

FAQS:
How can I generate a PDF (or any other available type) without opening the preview window ?

lDirectPrint - logical, Flag that directs the output directly to the printer, without preview (default = False)
cDestFile - character, determines the filename of the output file to be generated when "RunReport()" is called. If you set this property the report will not be previewed in the complete mode.

This for example prints a sample report of vfp9 to a tiff file:
Code:
CD c:\users\public\downloads\foxypreviewer && change to your foxypreviewer location after download.
SET PROCEDURE TO "FoxyPreviewer.App" ADDITIVE 
LOCAL loReport as "PreviewHelper" OF "FoxyPreviewer.App" 
loReport = CREATEOBJECT("PreviewHelper") 
WITH loReport as ReportHelper 
        .AddReport(HOME()+"\TOOLS\FILESPEC\90FRX.FRX", "NODIALOG") 
        .cDestFile = "d:\temp\90frx.tiff"  &&' Use to create an output without previewing
        .RunReport() 
ENDWITH 
loReport = NULL

Bye, Olaf.
 
Actually, I don't want to keep the pressure on user to enter the exact serial no. just scan it save it in a folder and upload the image in form. And, in the background the path should be saved.

Or, can we scan from VFP using ADF???

Thanks

Saif
 
I just showed you how to print your invoices to picture files without user needing to specify a filename.

What is your problem? What is ADF?

Did you answer Mikes question wrong? He asked you, what you have to begin with. If you have paper invoices to scan, someone or something has to get the invoice number from the paper or OCR (optical character recognition). That's why Mike asked.

From what you ask, I can only assume you still didn't describe your real problem good enough.

Bye, Olaf.

 
Thanks for Mr.Olaf

I am already using the foxypreviewer.App and it is a normal routine work to convert in excel, word, image and pdf. But,
it is not the requirement. The requirement is the second copy of the invoice which is being acknowledge by the customer and
they put their remarks about the products and others.

These remarks are very important for us in order to communicate with them.

Thanks

Saif
 
Hi Saif,
is your problem that your Customers have to scan a piece of paper with an external program and thereby have to save the scan with a name that is based on the basic invoice number?

If so, then this link might be of interest for you as it gives you a dll based access to any scan device attached to your pc:

[URL unfurl="true"]http://www.eztwain.com/eztwain1.htm[/url]
ATTENTION: Take care to use this download, as only this version is free. the current versions of eztwain have to be purchased!

just copy the dll into your app directory and place the declaration of the dll functions i.e. into you form.load event

DECLARE INTEGER TWAIN_SelectImageSource IN Eztw32.DLL INTEGER hWnd
DECLARE INTEGER TWAIN_GetSourceList IN Eztw32.dll
DECLARE INTEGER TWAIN_GetNextSourceName IN Eztw32.dll STRING @cSourceName
DECLARE INTEGER TWAIN_OpenSource IN Eztw32.DLL STRING cSourceName
DECLARE INTEGER TWAIN_AcquireNative IN Eztw32.DLL INTEGER nAppWind, INTEGER nPixelTypes
DECLARE INTEGER TWAIN_WriteNativeToFilename IN Eztw32.DLL INTEGER nDIB, STRING cFilename
DECLARE INTEGER TWAIN_FreeNative IN Eztw32.DLL INTEGER nDIB
DECLARE INTEGER TWAIN_SetMultiTransfer IN Eztw32.dll INTEGER nFlag

Within your form, you will have to call a function where the user is able to select the scanner device:

TWAIN_SelectImageSource(0)

After this, the scan interface can be accessed:

* // start scan
lnImageHandle = TWAIN_AcquireNative( 0 , 0 )
* // write scan into file
lnReply = TWAIN_WriteNativeToFilename( lnImageHandle , lcPath + lcFile )
* // remove scanner handle
TWAIN_FreeNative( lnImageHandle )

More infos should be availlable in this old dosadi tool.

HTH

EDIT:
Mike wrote about this tool already some15 years ago, so more details are availlable there, too :)
[link]http://www.ml-consult.co.uk/foxst-29.htm[/url] :)
 
You still don't say what you have at hand.

Who is scanning what? Tom assumes your customers scan your invoices.
I assume your employees scan in answers coming in from your customers in the form of papers now, related to some invoice.

In the end, a combination of scanning and ocr can then make the connection with one of your invoice numbers, but its typically a high effort to spare your employees this simple step to assign some documents to your own invoice number.

If you see us still fail to understand your problem, please be more communicative and descriptive, we're still not knowing all things to know about the workflow you want to optimize.

Maybe to guide you, I have these questions:

Who is scanning what?
Is your own software used for scanning or does a user select a scanned document pdf or image to assign to your invoices?
Do you print the documents you later scan with added remarks or such?

One thing easier than OCR is printing your documents with a barcode (QR for example) that can easier be recognized and help to relate the scanned document back to its root in your data, eg you can embed the invoice number in a QR code you print on the documents.

After scanning you need a two step process: a) finding the area of the scan having a QR Code and b) decoding that rectangle. Some QR code library might combine these two steps into one, ie it detects a QR code even when it's just part of a picture.

If this is really about automating the invoice number recognition you ask a lot, all we can give you on that topic is some advice and pointers, like the reference to twain from Tom. But scanning is just the first step to reading an invoice number back. QR and also other bar codes are an easier option in that they can be decoded even when slightly eroded or scanned tilted or stretched. Text recognition of printed text is easier than of hand writing, of course, but even that has often only partial success.

If I understand you correctly you ask in a forum post to add a major feature of a document management system for free. How much interest in your earnings do you offer us for implementing that feature into your software?

Bye, Olaf.
 
And to ask once more: What is ADF, you already posted after I asked that question and have ignored or not yet read it.

When I google ADF, this is my findings:

(Oracle) Application Development Framework
ADF radio
Amsterdam Density Functional
ADF.org An international religious organization devoted to creating a public tradition of Neopagan Druidism - personal judgement: I wouldn't even dare and care to visit that page.
And if I understand correctly, an assosiaction of french dentists (the latter two being non equivalent organisations, I assume, unless there are some Neopagan Druidism Dentists).

I am not used to that acronym or abbreviation, the typical developer term is framework or application framework, isn't it? And the known Foxpro frameworks are about data driven business line applications.

In regard of scan&ocr Scott168 once posted: thread184-1754724

Bye, Olaf.
 
ADF is Auto Document Feeder a scanner which scan multiple pages in one click.

Thanks

Saif
 
Maybe to guide you, I have these questions:

Who is scanning what?
Is your own software used for scanning or does a user select a scanned document pdf or image to assign to your invoices?
Do you print the documents you later scan with added remarks or such?

We scan the invoices after getting the acknowledgement on 2nd page of the invoice from the customers.
In this they put their remarks like delivery of the goods, short or excess, wrong delivery and so on...

These remarks are very important for us in order to communicate with them.

User scans the docs and for reference he has to open the image one by one in order to refer a particular invoice.

Thanks

Saif
 
Thanks for illustrating the workflow now.

So you scan in your own invoices after they have been processed by customers.
About the quantity: Does this happen to all invoices or just the complaints?
I ask because of the value of the effort to spare the assignment of the invoiice number

Secondly, you say employees "open the image one by one in order to refer a particular invoice."

I assumed the invoices are already named when they are scanned by your employeesand that's the point of interest to you.
Perhaps we should judge only after knowing: How many new scans do you need to process per day?

So your employees search for a certain invoice and if no scan of that invoice exists, have to browse through all scans not yet named correctly? Then an image viewer even like the one of Windows will make it easy to skip forward and back through all images of a folder, and while an employee is at searching his invoice number, why wouldn't he simply assign correct invoicenumber as file name to other invoices he looks at already? Just have a separate new scans vs assigned scans folder to make that image browsing easier.

Do you know and have a batch scanner?

Your solution strategies to automate the naming process and thereby assign the image to the data, are OCR or my QR Code suggestion, the latter is what I would prefer, as long as you don't also plan to manage scans of suppliers with their invoice number or other identifier. OCR suely is more versatile to use, once you have a good recognition, but at least to start with, every automatic invoice number recognition should be verified and confiremed.

And finally on the detail of adding a filename field to the tables instead of renaming files. Disregarding QR or OCR recognition of the invoice number: I think it's very valid and easy the way it is you generate the expected file name from the invoice number, what would be easier, an employee has to type in the invoice number anyway, either as new file name or for locating the invoice record the scan file should be assigned to. If you take it from the employee already being in the invoice record he searches, well, the inefficiency is about only searching that specific scan. Thet means I see a better workflow already with no technological change at all.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top