Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 09, 2016, 03:34:51 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: REQ - image search file maker  (Read 12554 times)

agent23

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
REQ - image search file maker
« on: August 01, 2009, 10:17:26 AM »
i would like a program that grabs the first result of a google images search and renames the flle based on the search terms. the search terms come from a list. this is a long list and each line, or list item, is each search string and needs to be the name of the file grabbed. this list is a .txt file
the images are to be saved in a folder i choose/create. the files should be .jpg if they are not already. if there are no results then no file is named.

example: 1) program reads 'picture of a red ball' from the .txt file 2) program googles for 'picture of a red ball' in google images 3) program saves
 the first result as 'picture of a red ball.jpg'

more e.g.
list -
some guy on boat
nov090147
happy death comics #110
abcxyz
123456

resulting file names after grab -
some guy on boat.jpg
nov090147.jpg
happy death comics #110.jpg
abcxyz.jpg
123456.jpg
« Last Edit: August 01, 2009, 10:20:09 AM by agent23 »

Gothi[c]

  • DC Server Admin
  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 858
    • View Profile
    • linkerror
    • Donate to Member
Re: REQ - image search file maker
« Reply #1 on: August 31, 2009, 10:57:11 PM »
Should be doable with a small perl script - but someone could probably write you a more windows-friendly autohotkey script a lot quicker...

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #2 on: September 03, 2009, 08:39:03 AM »
Hi

I'm willing to give this a spin if you like, do you still require it?

Hello all, my first post....  I'm normally on as a 'Guest'.

J
_____________________________________________
J.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,368
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #3 on: September 03, 2009, 12:28:44 PM »

Hello all, my first post....  I'm normally on as a 'Guest'.

Hello to you, too!  Nice to see someone new throw their hat into the ring.

agent23

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #4 on: September 04, 2009, 02:39:02 AM »
yes, i do still need this program. let me know if you have any questions. thank you for your time.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #5 on: September 04, 2009, 04:16:12 AM »
Me again.

Firstly, I apologise if etiquette on here is wrong, its only my second posting so I'm not really sure if the thread needs moving or anything.

Anyway agent23, I've knocked something very quick up.  And have attached it to here (I think).  Please give it a go and let me know if it suits your needs.  I'd appreciate any feedback.

The zip file contains the executable and a simple README.txt file.

Just to let you know, I noticed a lot of people seem to use AHK on here (which I have never used), I use FPC (Free Pascal) to write my stuff.  I hope that is acceptable?

Thanks

J.
_____________________________________________
J.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #6 on: September 04, 2009, 04:26:07 AM »
Oops.

in my keeness to upload my first program posting, I failed to realise a simple bug (nothing major).  The images are being saved in the root directory (i.e. C:\) and not in the selected folder.  (I was only testing by saving in c:\ so hadn't realised the bug!)

Its fixed now, and the updated version can be downloaded from this post.

Sorry!

J.
_____________________________________________
J.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,668
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #7 on: September 04, 2009, 06:06:15 AM »
Just to let you know, I noticed a lot of people seem to use AHK on here (which I have never used), I use FPC (Free Pascal) to write my stuff.  I hope that is acceptable?

Certainly.  :D  We're not biased here on programming langauge used.  The end result is what matters.  Nice work on your app.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,421
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: REQ - image search file maker
« Reply #8 on: September 04, 2009, 08:30:27 AM »
Hi awopbamboo and welcome!!

You have an interesting nickname -- maybe you can tell us where it came from, on this thread.

agent23

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #9 on: September 04, 2009, 06:05:34 PM »
nice. however, there were some problems.
when the .txt file is selected it does not get the content of the file
copying the items to the text area is fine, however it only grabs the first 64 lines/images. is there a way to increase the number to as close to unlimited as possible?

agent23

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #10 on: September 04, 2009, 06:56:56 PM »
ok, been using it more and the 64 thing isn't true, guess it was just that one time, it doesnt seem to work each and every time, i'll keep working and let you know. thanks.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #11 on: September 05, 2009, 01:52:47 AM »
Ok.

I found the issue too. For instance, try downloading using the word green. You'll see it does not create a file. I found what caused that problem, and that is now fixed.

I also found a slightly bigger problem in that some of the images downloaded seem to have a problem converting or en-coding to jpg. I have no idea why. It would take a lot of investigation. So, what I have done is IF there is a problem downloading (sometimes the links to the jpg's do not work) or encoding an image then the program will download the SECOND image in the result grid, if that fails then the third etc etc

Give it a try now.  If you come across any words or phrases that do not download and create a file, let me know what they are so I can try and find if there is a problem quicker.

An updated execuable is attached to this message.


J.
_____________________________________________
J.

agent23

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #12 on: September 05, 2009, 05:33:56 PM »
good work so far.
It does not need to generate a preview, however I don’t really care about that.
It seems to have problems handling more than a few hundred and I have thousands of items.
Very often it doesn’t get the first image. When I run a search manually I find a different, and correct, image, even after multiple tries. The file it’s finding is not the first result.
This may relate to another problem. When I enter a list of similar items it grabs the same image for all of them. Example, I search for “Robin #1” and “Robin #2” and Robin #{3, 4, … n} it grabs the same picture for all of them. Yet manually I get a different picture for each. (in this example they are all pics of the bird which is not near the first result) I realize this may be part of the encoding issue.
Also, some of the items may not be acceptable as file names, using characters that cannot be used in file names. I suppose we’ll just have to skip these for now.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #13 on: September 06, 2009, 12:40:51 AM »
Ok....

Firstly the previw, I can put a switch on it to hide the preview or just remove it altogether?  Its no overhead having it there, but won't be a problem to remove if you'd prefer?  Let me know.

I have downloaded many images, thousands, to test and haven't had a problem. I have checked for memory leaks and there aren't any. What happens when you try to download thousands? You said 'it has problems' but what do you mean exactly?

The issue with the first image and robin #1, #2 etc downloading the same images is indeed down to the url encoding.  That is now fixed in the download below.

I have also made a change so that any unacceptable filename characters are replaced with a <SPACE>. That should be fine for now or do you have another suggestion??

Let me know how it goes....

J.


/cont

Not heard anything for a few days, does this now work and suit your needs agent23?

J.
_____________________________________________
J.
« Last Edit: September 08, 2009, 10:04:38 AM by awopbamboo »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,368
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #14 on: September 08, 2009, 01:08:38 PM »
Hi awopbamboo,

I just tried this.
For me the following happens:

Program correctly reads 3 items from a test file
Accepts destination folder
Searches and displays 3 images, noting on each that the file is being saved
Program ends, re-displays original 'read info' requester (now with the last found image as its background)
Regrettably, no files are saved.

Windows XP Pro SP3


[Edit -- I should have used the old three-fingered salute before writing the above!
           Nice job!                                                                                           ]


« Last Edit: September 08, 2009, 01:27:24 PM by cranioscopical »

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #15 on: September 08, 2009, 02:26:32 PM »
Eh?

Does that mean it worked for you????

ta

J.
_____________________________________________
J.

Gothi[c]

  • DC Server Admin
  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 858
    • View Profile
    • linkerror
    • Donate to Member
Re: REQ - image search file maker
« Reply #16 on: September 08, 2009, 04:57:48 PM »
yeah, he just needed a reboot :)

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,368
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #17 on: September 08, 2009, 05:49:04 PM »
Does that mean it worked for you????
Yes, works very nicely. Thanks!

I'd like it even more if, instead of a single image, one could specify a number of images to download.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #18 on: September 09, 2009, 05:40:53 AM »
I'd like it even more if, instead of a single image, one could specify a number of images to download.


Ok, Thats done.

Just add a / then the number you want to download of that image... i.e.

ape /4
chimp /3
monkey
zebra /6

The files will be named 'ape.1.jpg, ape.2.jpg' etc

New file attached.

J.
_____________________________________________
J.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,368
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #19 on: September 09, 2009, 07:40:14 AM »
I'd like it even more if, instead of a single image, one could specify a number of images to download.


Ok, Thats done.

Just add a / then the number you want to download of that image... i.e.

ape /4
chimp /3
monkey
zebra /6

The files will be named 'ape.1.jpg, ape.2.jpg' etc

New file attached.

J.
Thanks a lot!
One more request.
Can you provide a way either to default to a fixed, user-supplied download location, or to remember the location used for the previous run?
And, just as a cosmetic suggestion, what do you think of having the background reset to the default when completed, rather than retain the last-downloaded image?
« Last Edit: September 09, 2009, 07:51:04 AM by cranioscopical »

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #20 on: September 09, 2009, 10:08:50 AM »
One more request.
Can you provide a way either to default to a fixed, user-supplied download location, or to remember the location used for the previous run?
And, just as a cosmetic suggestion, what do you think of having the background reset to the default when completed, rather than retain the last-downloaded image?

Thats done now:
09/SEP/2009 : Added commandline switches
/d <default_directory_name>
/f <wordlist_file>
/r Run the search as soon as app loads (same as clicking the 'Go' button)
/q close app after running

So, you wanted to load a word list in a file named LIST.TXT, and output the images to C:\IMAGES and execute immediately (non intractively), then quit the app once its done....
Getimage /f list.txt /d c:\images /r /q
Or just default a directory to use:
GetImage /d c:\images


New file attached....

J.
_____________________________________________
J.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,368
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #21 on: September 09, 2009, 12:49:06 PM »
Thats done now:
09/SEP/2009 : Added commandline switches
/d <default_directory_name>
/f <wordlist_file>
/r Run the search as soon as app loads (same as clicking the 'Go' button)
/q close app after running

That's very obliging of you and it works nicely.
Thanks again!

agent23

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #22 on: September 11, 2009, 09:03:41 PM »
i haven't been able to use it for a while. seems to be working a lot better. i don't like the thing that says "can't find any" because i have to click "ok" every time and i'd rather just let it run and go do something else. if it can't find any i'd rather it just skipped it. been big help so far.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 114
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #23 on: September 11, 2009, 11:54:07 PM »
Yes, I ageee.  I'll take that out,  it was only there in the first place to let me know, wasnt suposed to be permenant!
_____________________________________________
J.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,368
    • View Profile
    • Donate to Member
Re: REQ - image search file maker
« Reply #24 on: September 12, 2009, 12:02:20 AM »
Yes, I ageee.  I'll take that out,  it was only there in the first place to let me know, wasnt suposed to be permenant!
Would it be worthwhile to create some sort of (optional?) log file, so that if something isn't found there's a record of that fact?