Image Events save as PICT broken?
An old script that worked in Lion is not working in Mountain Lion.
Here is a test example:
tell application "Image Events"
launch
set theImage to open "/tmp/c13.jpg"
save theImage as PICT in file "/tmp/image.pict"
close theImage
end tell
If the output file already exists, this script does nothing and does not complain. If the output file does not already exist, I get an error that the image "doesn't understand the save message".
Other image file formats besides PICT work fine.
Any ideas?
Hi,
The QuickDraw API (Macintosh PICT format) have long been obsolete (they've mostly been
deprecated since Mac OS X 10.4). But we still use them in a few places
(in 32-bit mode) for backwards compatibility. (QuickDraw APIs are unavailable in 64-bit mode).
Apple will remove the 32-bit system libraries in some future version of OS X and dropping support for 32-bit apps.
Solution : Try selecting 'Open in 32 Bit Mode' in the Finder's info window for the application "Image Events"
I know it works for Preview on OS X 10.8 (it can still open PICT format), but I don't know for "Image Events".
Similar Messages
-
The following script works correctly:
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}
global eventsFolder, ProcessedfolderName, events_Folder
on runConversion(theItems)
activate "Finder"
set saveFolder to choose folder with prompt "Save resized pictures where?" without multiple selections allowed and invisibles
tell application "Image Events"
launch
set newWidth to 120
if (count items of theItems) is greater than 0 then
repeat with anItem in theItems
set theName to the name of anItem
tell application "Finder" to set myNewFileName to (saveFolder as string) & "tmb_" & theName
set imageFile to (open anItem)
scale imageFile to size newWidth
save imageFile as PNG in file myNewFileName
close imageFile
end repeat
else
display dialog "Nothing to convert."
end if
end tell
end runConversion
mount volume someVolume
set root_Folder to root_Folder as alias
set events_Folder to events_Folder as alias
set theStr to (current date) as string
set d to date theStr
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
tell application "Finder"
set events_Folder to events_Folder as alias
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
set new_FileFolder to make new folder at events_Folder with properties {name:ProcessedfolderName}
move (every file of events_Folder whose name ends with ".png") to new_FileFolder
set oldFiles to every file of events_Folder
set thecount to number of items of oldFiles
end tell
set theFiles to choose file with prompt "Choose the files" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)
activate
BUT if I modify it to the following, it gets hung up on "scale imageFile to size newWidth"
error "The variable imageFile is not defined." number -2753 from "imageFile"
Maybe it has something to do with the line
'set theFiles to choose file with prompt "Choose the files" of type openTypes with multiple selections allowed without invisibles'
which is not in the broken script.
The broken script is as follows:
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}
global eventsFolder, ProcessedfolderName, new_FileFolder, imageFile
on runConversion(theItems)
activate "Finder"
set saveFolder to new_FileFolder
set theItems to every file of the saveFolder
tell application "Image Events"
launch
set newWidth to 120
if (count items of theItems) is greater than 0 then
repeat with anItem in theItems
set theName to the name of anItem
tell application "Finder" to set myNewFileName to (saveFolder as string) & "tmb_" & theName
set imageFile to (open anItem)
scale imageFile to size newWidth
save imageFile as PNG in file myNewFileName
close imageFile
end repeat
else
display dialog "Nothing to convert."
end if
end tell
end runConversion
mount volume mountVolume
set root_Folder to rootFolder as alias
set events_Folder to events_Foler as alias
set theStr to (current date) as string
set d to date theStr
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
tell application "Finder"
set ProcessedfolderName to ((month of d as integer) & "_" & day of d) as text
set new_FileFolder to make new folder at events_Folder with properties {name:ProcessedfolderName}
move (every file of events_Folder whose name ends with ".png") to new_FileFolder
set oldFiles to every file of events_Folder
set thecount to number of items of oldFiles
end tell
set theFiles to every file of new_FileFolder
runConversion(theFiles)
activateSeveral lines of the “broken” script seem to be badly written, for example:
set root_Folder to rootFolder as alias -- rootFolder instead of root_Folder
set events_Folder to events_Foler as alias -- Foler instead of Folder
Message was edited by: Pierre L. -
Quality of JPEG when being converted by Folder Actions (Image Events)
I take a lot screenshots with Command + Shift + 3/4. They are in PNG and I love them. Yet, I need to send them via email sometimes.
I convert them to JPEG using Preview, but it is time-consuming when especially I have hundreds of them.
I have just learnt that it is possible to do convert in batch using Folder Actions. However, I meet few very serious problems.
1. In Preview, I could choose the quality of JPEG before converting. But, there is no such option in Folder Actions. I even searched online to try to modify the script and it seems that nobody cares about the quality of converted JPEG.
My question: What is the quality of JPEG converted? And, is it possible to modify it?
2. Since I do not know the quality of conversion using Folder Actions, I tried different qualities using Preview and match the outputs with those using Folder Actions. I got no result. As Preview is using Core Image as the processing architecture.
My question: What is the image processing architecture adopted by Image Events?
3. If the quality is unchangeable, can anyone teach me how to write a new script to do the conversion using Preview?
I really hope Mac OS gurus could explain these to me and possibly solve my problems. I am interested to learn the AppleScript part to modify it.
Thank you very much.It is the original folder action script from Mac OS. Here is the copy.
Could you help me as well where to add the "compression level"? Also, what do "high", "low" and "medium" mean, in % just like Preview, if they use the same image processing architecture?
Again, thank you very much for quick reply.
================
Image - Duplicate as JPEG
This Folder Action handler is triggered whenever items are added to the attached folder.
The script creates a JPEG version of the file, but leaves a copy of the file
in its original format. If the original file is already in JPEG format, the script does
not duplicate the file.
Copyright © 2002–2007 Apple Inc.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
property done_foldername : "JPEG Images"
property originals_foldername : "Original Images"
property newimage_extension : "jpg"
-- the list of file types which will be processed
-- eg: {"PICT", "JPEG", "TIFF", "GIFf"}
property type_list : {"TIFF", "GIFf", "PNGf", "PICT"}
-- since file types are optional in Mac OS X,
-- check the name extension if there is no file type
-- NOTE: do not use periods (.) with the items in the name extensions list
-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}
property extension_list : {"tif", "tiff", "gif", "png", "pict", "pct"}
on adding folder items to this_folder after receiving these_items
tell application "Finder"
if not (exists folder done_foldername of this_folder) then
make new folder at this_folder with properties {name:done_foldername}
end if
set the results_folder to (folder done_foldername of this_folder) as alias
if not (exists folder originals_foldername of this_folder) then
make new folder at this_folder with properties {name:originals_foldername}
set current view of container window of this_folder to list view
end if
set the originals_folder to folder originals_foldername of this_folder
end tell
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
tell application "Finder"
my resolve_conflicts(this_item, originals_folder, "")
set the new_name to my resolve_conflicts(this_item, results_folder, newimage_extension)
set the source_file to (move this_item to the originals_folder with replacing) as alias
end tell
process_item(source_file, new_name, results_folder)
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
on resolve_conflicts(this_item, target_folder, new_extension)
tell application "Finder"
set the file_name to the name of this_item
set file_extension to the name extension of this_item
if the file_extension is "" then
set the trimmed_name to the file_name
else
set the trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name
end if
if the new_extension is "" then
set target_name to file_name
set target_extension to file_extension
else
set target_extension to new_extension
set target_name to (the trimmed_name & "." & target_extension) as string
end if
if (exists document file target_name of target_folder) then
set the name_increment to 1
repeat
set the new_name to (the trimmed_name & "." & (name_increment as string) & "." & target_extension) as string
if not (exists document file new_name of the target_folder) then
-- rename to conflicting file
set the name of document file target_name of the target_folder to the new_name
exit repeat
else
set the name_increment to the name_increment + 1
end if
end repeat
end if
end tell
return the target_name
end resolve_conflicts
-- this sub-routine processes files
on process_item(source_file, new_name, results_folder)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
try
-- the target path is the destination folder and the new file name
set the target_path to ((results_folder as string) & new_name) as string
with timeout of 900 seconds
tell application "Image Events"
launch -- always use with Folder Actions
set this_image to open file (source_file as string)
save this_image as JPEG in file target_path with icon
close this_image
end tell
end timeout
on error error_message
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end try
end process_item -
Help needed with Image Events problem
Hi there I'm writing what I thought was a simple script to convert a folder full of images from jpg to tiff. But the script fails when trying to convert the first image in the folder. Instead of converting the image, Preview opens with the image shown and I get this error message: error "The variable ImageRef is not defined." number -2753 from "ImageRef".
I have seen some posts about other people having the same problem, but I haven't seen any solutions.
Here's the script.
on run
tell application "Finder"
set PicturesFolder to ((path to home folder) as string) & "Pictures:SenseCam" as alias
set Photographs to (get entire contents of PicturesFolder) as alias list
end tell
tell application "Image Events"
launch
repeat with Photo in Photographs
if (Photo as string) ends with "jpg" then
set ImageRef to open Photo
save ImageRef in Photographs as TIFF
close ImageRef
end if
end repeat
end tell
tell application "Finder"
repeat with Photo in Photographs
delete Photo
end repeat
end tell
end run
Thanks in advance for any help.
JohnHello
You may try something like the modified code below.
Noticiable changes :
#1 - Removed the parentheses. Your original code won't yield alias list but a list of finder objects, which is the reason why Preview opens the image. (The statment 'open finderObject' behaves the same as double clicking it in Finder)
#2 - Only delete the original jpeg files which are converted to tiff.
#3 - Build new path for converted image.
#4 - Save in new path. (When saving image in a format other than its original format, always save the image to a new file and do not attempt to overwrite the source file.)
cf.
http://www.macosxautomation.com/applescript/imageevents/08.html
on run
tell application "Finder"
set PicturesFolder to (path to home folder as string) & "Pictures:SenseCam:" as alias
set Photographs to get entire contents of PicturesFolder as alias list -- #1
end tell
set DonePhotos to {} -- #2
tell application "Image Events"
launch
repeat with Photo in Photographs
set Photo to Photo's contents
set oldPath to Photo as string
if oldPath ends with ".jpg" then
set newPath to oldPath's text 1 thru -5 & ".tif" -- #3
set ImageRef to open Photo
save ImageRef as TIFF in newPath -- #4
close ImageRef
set end of DonePhotos to Photo -- #2
end if
end repeat
end tell
tell application "Finder"
delete DonePhotos -- #2
end tell
end run
Hope this may help,
H -
Image Events not resizing tiff
Hello,
I have been trying to get some results from Image events for 5 hours now.
Below is what I will use to express the issue I am encountering.
When running the following script in script editor it appears to do what is asked of it but in the end the file is unchanged.
It is almost as if Image Events is not working.
Would someone please provide a step of troubleshooting for me?
When I use return I get the file I selected.
====Script=====
set this_file to choose file
try
tell application "Image Events"
launch
set this_image to open this_file
scale this_image to size 318
pad this_image to dimensions {320, 240}
save this_image with icon
return this_image
close this_image
end tell
on error error_message
display dialog error_message
end try
====END Script====
Thank you very much.Thanks for checking this Pierre.
What I meant by saying it appears to do what is asked of it... is that I didn't receive any errors.
I just did a major edit on the post because it was that my tiff files I was trying to process were CMYK. I converted them to RGB in Photoshop and they processed just fine.
Not a solution though. I don't want to have to go through Photoshop because I have thousands of images to process.
I tried to find the command to convert from CMYK to RGB in Image Events and can't find that.
Can someone help me with the command to do that conversion in Image Events or at least without having to run Photoshop to do it?
Thank you so very much in advance.
Jeff
Message was edited by: Jeffrey DeRousse
Message was edited by: Jeffrey Derousse -
I just installed CS5 Photoshop. I cannot save any image as a pict file. The option to save as pict is not there. Has this been removed? thanks
Yes, support for writing PICT files has been removed.
PICT was a QuickDraw format, and requires QuickDraw and Carbon to work with.
Photoshop CS5 moved to Cocoa APIs, and can no longer work with PICT images. We kept some minimal PICT support for a subset of PICT that didn't need QuickDraw, but we only read it. -
Applescript Image Events appears to have memory leak (or I don't know what I am doing)
Using Image Events to create images and thumbnails for a website. The following code results in very large memory leaks in Image Event process. I have documented results of test runs in the comments.
The leak (or poor coding on my part) results in a total system halt if I attempt to process more than about 400 images at a time. Basically, I run out ot physical memory. I am running a new model 13" MBP with 8GM RAM. I have to manually stop Image Events to reclaim the memory (or reboot of course).
Any help/suggestions would be appreciated.
(* test memory leak in Image Events *)
tests with 58 photos selected in iPhoto
5.7 MB left in Image Events after run with only open and close
22.0 MB left in Image Events after run with open, save and close
45.9 MB left in Image Events after run with open, scale, save and close
A run with 382 photos selected used OVER 3.8 GB (gigabytes) and the
mac ran out of physical memory so I had to stop the test.
tell application "Finder"
set imageFolder to folder "test" of home as alias
end tell
tell application "iPhoto"
set currPhotoList to the selection
repeat with currPhoto in currPhotoList
log name of currPhoto as string
set theImagePath to image path of currPhoto
tell application "Image Events"
launch
set theImage to open theImagePath
scale theImage to size 128
save theImage in imageFolder as JPEG with icon
close theImage
end tell
end repeat
end tell
--- end of code exampleDoes the following code do any difference? Most likely no I guess… but better try than nothing.
tell application "Finder"
set imageFolder to folder "test" of home as text -- instead of “as alias” (see theTargetPath below)
end tell
set theImagePaths to {}
set theImagePathsRef to a reference to theImagePaths -- faster with big lists
tell application "iPhoto"
set currPhotoList to the selection
repeat with currPhoto in currPhotoList
log name of currPhoto as string
get POSIX file (image path of currPhoto) as alias -- faster ?
copy result to the end of theImagePathsRef
end repeat
end tell
tell application "Image Events"
launch
repeat with theImagePath in theImagePaths
set theImage to open theImagePath
scale theImage to size 128
set theTargetPath to (imageFolder & name of theImagePath)
save theImage in theTargetPath as JPEG with icon
close theImage
end repeat
end tell -
How do I take an object from an image and save it so I can use it in other images?
I am trying to figure out how to take an object from an image and save it so I can re-use it again in other pictures? I know how to use the magic wand to select the object and place it in a blank image.... but I do not know how to re size the selected object or keep it for later use. Basically I would like to use the object the same way that I use the graphics ... so I guess I am wondering if there is a way that I can make my own graphics... I have Elements Photoshop 13. Thanks for any help/advice.... Jerrie
Hi Jerrie,
You can re-size using Transformation tool. Ctrl + T will give you a box to re-size the image or object.
You can save these object as PNG file with Transparent layer. You can use these objects later in another projects.
Regards,
Sandeep -
Revision: 15505
Revision: 15505
Author: [email protected]
Date: 2010-04-16 09:29:26 -0700 (Fri, 16 Apr 2010)
Log Message:
Fix image smoothing, which had been broken as a result of some changes to how the display object of an ImageElement is exposed. Add integration test.
Modified Paths:
osmf/trunk/framework/OSMF/org/osmf/elements/ImageElement.as
osmf/trunk/framework/OSMFIntegrationTest/org/osmf/elements/TestImageElementIntegration.asThat's a comment in the file. It has no effect at all.
-
Is there any way I can program "Capture" to save pnp.picts on the desk, but always under the same name, without a date ?
It may be sound weird, but I use it in a very special way, and I would like, like photoshop, that capture just replace
the previous pict by the new one..without any warning.
PierreThere is no way to go back from an XFA form to an Acroform even with Acrobat Pro, still less with Acrobat. You either need to remake the form, or change your plans to use a third party viewer - Adobe have an excellent range of programs they would like you to use!
-
Looking for a BAPI or BADI for ML81N EVENT SAVE
Good Morning to everyone !!!
I would like to know if exist an BADI or USER EXIT for ml81n transactions in the event SAVE. If exist please let me know the name of them and an example of it could be the best for me.
Thanks in advantage for your help, I solved my problem about MIRO yesterday thanks to everyone for your contribution.
Regards
Marta Cecilia
From ColombiaHello,
You can try with BADI INVOICE_UPDATE interface named
if_ex_invoice_update, method: change_at_save
Go tx code se19 and implement the interface and method I have told you.
example,
METHOD if_ex_invoice_update~change_at_save.
IF sy-tcode EQ 'ml81n'
message 'hello' type 'E'.
ENDIF.
ENDMETHOD.
Hope this helps, dont forget to reward,
Gabriel -
SuperImpose two images and save it as a single image[urgent]
Hello..
Can anyone tell me how do we superimpose two images and save it as a single image.The image on the top is smaller in size in my case.
Please Help..import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
class TwoBecomeOne {
public static void main(String[] args) throws IOException {
BufferedImage large = ImageIO.read(new File("images/tiger.jpg"));
BufferedImage small = ImageIO.read(new File("images/bclynx.jpg"));
int w = large.getWidth();
int h = large.getHeight();
int type = BufferedImage.TYPE_INT_RGB;
BufferedImage image = new BufferedImage(w, h, type);
Graphics2D g2 = image.createGraphics();
g2.drawImage(large, 0, 0, null);
g2.drawImage(small, 10, 10, null);
g2.dispose();
ImageIO.write(image, "jpg", new File("twoInOne.jpg"));
JOptionPane.showMessageDialog(null, new ImageIcon(image), "",
JOptionPane.PLAIN_MESSAGE);
} -
On my MacBook Pro whenever I select an image to save or copy, it selects the whole page. Also does a similar thing on iTunes: whever I select an album cover it gives the whole listing.
Mac 101
see
http://support.apple.com/kb/index?page=search&src=support_site.kbase.search&loca le=en_US&q=screen%20capture -
I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.
Just go back in photoshop and use the Slice Select tool, then just click and select the slice and hit delete - if you're not sure which one is the active slice just right click and find the one that has the Delete Slice option.
It's possible you either added the slices by accident or if you received it from someone they just had the slices hidden. For the future, you can go to View > Show > Slices to display (or hide) slices. -
AppleScript to resize images and save with new name
I want to make an apple script, which resizes all images of a folder regardless what kind of filetype.
The source folder will change every day.
With the script i want to choose a source Folder, resize all images and save the files with my jpeg options in the same folder, but with adding „_ipad“ in the filename.
I tried to edit an existing script from this forum, but in Photoshop 5.1 i get the error-message "This function is possibly not available in this Version" in line 18 "save in file newFileName as JPEG with options myOptions"
How can i save the documents with new name in the existing folder?
Thanks.
This is the script i’m working with:
set inputFolder to choose folder with prompt "Wähle einen Ordner:"
--set destinationFolder to choose folder with prompt "Wähle einen Zielordner" as string
tell application "Finder"
set filesList to (files of entire contents of inputFolder) as alias list
end tell
tell application "Adobe Photoshop CS5.1"
set UserPrefs to properties of settings
set ruler units of settings to pixel units
repeat with aFile in filesList
open aFile showing dialogs never
set docRef to the current document
tell docRef
set newFileName to my getBaseName(name)
--resize image height 240 resolution 72 resample method bicubic sharper
change mode to RGB
resize image resolution 72
set myOptions to {class:JPEG save options, embed color profile:true, quality:12, format options:progressive, scans:3}
save in file newFileName as JPEG with options myOptions
end tell
close the current document saving no
end repeat
set ruler units of settings to ruler units of UserPrefs
end tell
on getBaseName(fName)
set baseName to fName
repeat with idx from 1 to (length of fName)
if (item idx of fName = ".") then
set baseName to (items 1 thru (idx - 1) of fName) as string
exit repeat
end if
end repeat
return baseName
end getBaseNameThis seems like a Photoshop error not an AppleScript one. Have you looked in the Photoshop dictionary to see if the command you are getting the error on exists and if it has those options?
If all you want to do is resize image files and save the resized image file you might want to look at Automator. Specifically the Scale Image action under Photos.
regards
Maybe you are looking for
-
Email address as an username for the ADF application login.
Hi All, We have a requirement in our ADF application by creating usernames as an email address .We created an ADF application and deployed on the server by creating some users in the jazn-data.xml in our project code with the users as "admin1","admin
-
Hi, I want to transfer a xml-file representing an invoice to Oracle Payables. This is to be done by writing a java program. I'm pretty stuck so I would appreciate any kind of help. Litterature, web-pages etc. Regards Ardalan
-
We have just begun using SELECT ENTERPRISE to perform OO modeling in conjuction with Forte development . We have not yet reach the point of code generation but have heard through the grapevine that there are problems with SELECT/FORTE in the original
-
The Software Update Server (r344.local) is not responding.
Hello Everyone I hope someone can help me with the below. I recent updated to OSX 10.7.3 Since the update i havent been able to run automatic updates, it trys to run and then comes back with the below. " The Software Update Server (r344.local) is not
-
Extract the area selection code out of gnome-screenshot
Long ago, I asked about a tool for selecting a screen area and get the geometry of it, and I did get very helpful feedback from Hashbox, and in the end produced a tool called xrectsel. But the flaw with xrectsel is that if while dragging the rectangl