How to convert an image file using Preview application

i am trying to convert an file of the type pdf to jpg using applescript, i’ve tried calling the preview but i cant find anything that explains or teach about this. There is no explanation in the dictionary. Can somebody help me? i"ve tried this but it doesnt work.

tell application “Preview”
open file “MacintoshHD:local:000250120905049.eps”
save document as “JPG” in file “MacintoshHD:local:TMP.jpg”
end tell

I don’t know if Preview is scriptable. Not ever application is. If you go to the file menu in script editor and select open dictionary, and click browse… you’ll see that some applications are shown greyed out. That means they don’t have a dictionary and aren’t directly scriptable.

The Image Events app is good for what you’re doing. I pretty sure it will do eps to jpeg, but you could also use Graphic Converter or Photoshop.

tell application “Image Events”
set theImage to open “MacintoshHD:local:000250120905049.eps”
save theImage as JPEG in “MacintoshHD:local:TMP.jpg”
close theImage
end tell

Do a search here for more info on Image Events and a link to Apple’s page of Image Events scripts.