convert to gray scale
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
convert to gray scale
I have been trying some routines that use ocr and have discovered that my results are only reliable when I have an image converted to grayscale.
So I have been searching the internet trying to find vb code for converting an image file to gray scale and have come up empty.
Does anyone have a solution ?
Thank you for your help.
So I have been searching the internet trying to find vb code for converting an image file to gray scale and have come up empty.
Does anyone have a solution ?
Thank you for your help.
Last edited by SuitedAces on Sun Feb 24, 2008 12:01 am, edited 2 times in total.
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Two image processing programs with command line modes that can be scripted with macroscheduler to do a greyscale conversion are ImageMagick and Irfanview. (Note that Irfanview likes the US spelling "gray".)
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
I in fact have infraview and tried the command lines to convert a file to gray scale and ran into errors trying to get it to work from macro scheduler.
Would you provide an example for me please.
Would you provide an example for me please.
Last edited by SuitedAces on Sun Feb 24, 2008 12:01 am, edited 1 time in total.
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
I just tried this and it works for me:
Works with .bmp too.
Code: Select all
RunProgram>C:\IrfanView\i_view32.exe c:\test\test.jpg /gray /convert=c:\test\graytest.jpg
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
It does not work for me.
What it does in when I run it is it opens the infraview window with the gray scale image , instead of saving it to a file.
Obviously that wouldn't be part of a running code.
In code, it would need to convert a file to gray scale, and save it, so it could then be processed with ocr.
What it does in when I run it is it opens the infraview window with the gray scale image , instead of saving it to a file.
Obviously that wouldn't be part of a running code.
In code, it would need to convert a file to gray scale, and save it, so it could then be processed with ocr.
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Glad it's working for you. I just tested with a .gif and the code I posted works fine for me with that too. The only time I got the irfanview window opening with the grayscale image was before I figured out I need to add the /convert=filename part on there to save it. Maybe you have an extra space in there? Maybe it's a version thing, I have 4.10.
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
Well I cannot explain that, I have two versions of infraview installed maybe I should uninstall the older version.
But I get a window asking about transparency when I use gifs.
It is curious that I do and you don't , but in the end it isn't an issue because it is not one of the default image types in macro scheduler.
I really appreciate you replying and I'm glad to have gotten it sorted out.
The ablity to resize the image through infraview has also come into use for me with ocr.
Between resizing and going to grayscale ocr has become far more reliable.
But I get a window asking about transparency when I use gifs.
It is curious that I do and you don't , but in the end it isn't an issue because it is not one of the default image types in macro scheduler.
I really appreciate you replying and I'm glad to have gotten it sorted out.
The ablity to resize the image through infraview has also come into use for me with ocr.
Between resizing and going to grayscale ocr has become far more reliable.