Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Change Pasted Image format from Tiff to JPG How?

I would like to have my images paste into mail as jpegs,gifs,pngs, whatever the source format, rather than being converted to TIFF format which is not viewable by a large number of users.

To change the clipboard, in terminal one writes:
defaults write com.apple.screencapture type jpeg

Is there a similar command that will change the default image formmat for mail?

macbook pro 17, Mac OS X (10.4.10)

Posted on Jan 2, 2009 11:33 AM

Reply
37 replies

May 12, 2009 11:58 AM in response to madpixl

After looking for an answer to this problem, and not finding one...and then after banging my head against AppleScript for a few hours, I finally came up with this workaround. It's not perfect, but it suffices for what I need--making copy/paste of images from Gimp to Mail into JPEGs instead of TIFFs.

Open Script Editor and make a new script with the following contents:

*set tp to 0*
*repeat with i in clipboard info*
*if TIFF picture is in i then*
*set tp to the clipboard as TIFF picture*
*exit repeat*
*end if*
*end repeat*

*if tp ≠ 0 then*
*set dt to current date*
*set dtstr to (time of dt as string) & ".tiff"*
*set pt to ((path to temporary items from user domain as string) & dtstr)*
*-- display dialog "Temporary file is: " & pt buttons {"Ok"} default button 1*
*set tf to open for access file pt with write permission*
try
*write tp to tf*
*close access tf*
*on error error_message*
*close access tf*
*display dialog error_message buttons {"Ok"} default button 1*
*end try*
*tell application "Image Events"*
launch
*set this_image to open file pt*
*save this_image as JPEG in (pt & ".jpg") with compression level high*
*close this_image*
*-- delete the TIFF temporary file*
*set ptposix to POSIX path of alias pt*
*do shell script "rm " & quoted form of ptposix & ""*
*-- set the clipboard to the created JPEG file*
*set the clipboard to (alias (pt & ".jpg")) as «class furl»*
*end tell*

*display dialog "Done. A JPEG Image has been copied to the clipboard." buttons {"Ok"} default button 1*
else
*display dialog "No TIFF image was found on the clipboard." buttons {"Ok"} default button 1*
*end if*

Save that in Home > Library > Scripts. Then you can either use the AppleScript Utility to "Show Script menu in menu bar", or save the script as an Application and drag it to your dock. There's probably a way to make it appear in the context menu, but I don't know how off hand. If you want to get fancy I'm sure there's a way to give it a keyboard shortcut.

After you copy something to your clipboard, run the script or application you saved, and it will convert what's on the clipboard to a JPEG file (saved in Home > Library > TemporaryItems) and copy a reference to the JPEG file back to the clipboard. Then, you can paste directly into Mail and it will be a JPEG.

The conversion process takes a few seconds, maybe worse on older hardware, but it gets the job done. At least, it works for me 🙂 .

Aug 8, 2009 5:52 PM in response to Matt Williamson

This is fantastic, and does exactly what I need. However, when I capture a screenshot using shift-control-command-4, it is saved on the clipboard as a PNG file, not a TIFF. Do you know how I could modify your script to allow for this? I tried changing TIFF to PNG in the script but got the following error from Script Editor:

Syntax Error - Expected "then", etc. but found class name.

Many thanks

Aug 9, 2009 2:11 AM in response to Kurt Weber

Thanks for the tip. I use Skitch when I want that functionality. It does much the same thing.

I just realised my previous post was incorrect. When I snap a portion of the screen with shift-control-command-4 it is saved as a TIFF file to my clipboard. Or at least I assume so, because if I paste it into an email it is titled "pastedGraphic.tiff".

The problem is when I run the AppleScript above, I get the message "No TIFF image was found on the clipboard" every time. I incorrectly assumed it was because I had a PNG on the clipboard, but I assume there is just a problem with the script.

Cheers,

Greg

Aug 10, 2009 11:38 AM in response to Ernie Stamper

Here's what I am experiencing: While I am using Firefox, if I right-click and "copy image" a jpeg in a web page -- then right-click and paste that into the body of a message in Apple's Mail it will convert to a tiff and be more than ten times larger. If I do the exact same thing, but using Safari instead of Firefox, it stays a jpeg. Why? I'll leave that for smarter people.

Sep 16, 2009 9:41 PM in response to David Davidson1

Agreed, the original question has not been answered, let's get this back on topic.

Problem:
Right click copy from firefox (or other app) then paste into the body of Mail email, produces a large .tiff image in the email, not the original image from the web.

Demonstration of problem:
1. Open firefox and go to this image on CNN's page.

http://i.cdn.turner.com/cnn/.element/img/2.0/global/nav/header/headercnn_comlogo.gif

2. Notice the CNN logo on your screen, notice it is a .gif file.
3. Right click and select "copy image"
4. Open new email in Mail
5. In body of message right click and paste
5. Right click on the image and choose "view as icon" if it is not already an icon.
6. Notice the file type is now .tiff

Problem demonstrated.

If this was a larger image, the file size would be huge.

Is there a work around to paste the original .gif image, unconverted, or any image unchanged for that matter, captured via this method of copy/paste.

Note:
Saving the file to the desktop and attaching it, is 2-3 extra steps, and then requires going back to clean up the temporary file... and is not very 'mac like' in user interface or efficiency.

Thanks
Vince

Change Pasted Image format from Tiff to JPG How?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.