Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Safari and Photoshop - Applecript challenge

Safari and Photoshop - Applecript challenge
Thread Tools
Banned
Join Date: Oct 2003
Status: Offline
Reply With Quote
Nov 23, 2003, 11:06 AM
 
I was looking for a hi-res streetmap of london, (to print and put on a wall), but couldn't find anything...

However, there is this which let's you see only a very small part of a zoomed-in map at once,

I thought about copying each image and pasting it together in photoshop... but it would take about a week to do it.

I've worked out that the site generates jpegs on the fly, and they can be displayed with the following url:

http://booth.lse.ac.uk/cgi-bin/mrsid...amp;height=600

The URL above shows the top-left corner of the map (hence the blacked out bit), because x=0 and y=0 in the URL. The width and height maximums appear to be 800 and 600 respectively (you can put in more but it won't make a difference)

Now, what I'd like to do is get an Applescript to automatically step thru all the images and paste them together in Photoshop.

Here's the pseudo-code:
loop while X = 0 to 21600 step 800
--loop while Y = 0 to 14400 step 600
----load URL in Safari with X and Y co-ordinates
----copy the image
----paste image in Photoshop in correct position
--end loop
end loop


Unfortunately, I don't know any Applescript, so any ideas?
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Nov 23, 2003, 04:21 PM
 
As far as I know, Safari doesn't allow you to copy images through scripting.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Nov 24, 2003, 06:20 AM
 
The maps are Copyrighted - so technically you are stealing... (+ you are stealing bandwidth from the LSE.)

2 - this script only does the getting - the stitching together in Photoshop is up to you.


Code:
set xindex to 0 repeat until xindex > 21600 set yindex to 0 repeat until yindex > 14400 -- log (yindex) set urlString to "http://booth.lse.ac.uk/cgi-bin/mrsid2jpeg.pl?image=/images/maps/barth2000.sid&x=" & xindex & "&y=" & yindex & "&level=0&width=800&height=600" set localPath to "~/mapImages/" & xindex & "x" & yindex & ".jpg" set scriptText to "curl \"" & urlString & "\" -o " & localPath do shell script (scriptText) -- log (scriptText) set yindex to (yindex + 600) end repeat set xindex to (xindex + 800) end repeat
for the code to work properly you will need a directory called "mapImages" in your home dir.

oh - p.s. don't blame me when the LSE bans your IP addr !

p.s. the total number of images you will download is 648 at about 100k each - that's about 65 Mb.

[edited to fix looping error and 600 vs 800 typo]
(Last edited by Diggory Laycock; Nov 24, 2003 at 06:52 AM. )
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:27 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2