Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading PICT Images



Adrian Sutton wrote:

Has anyone found a good way to read PICT images in Java? Eventually I want
to convert it to a PNG, JPG or GIF so it¹s web compatible. If I can get it
into a java.awt.Image I can handle the conversion but I can¹t seem to do
that even.


There are a lot of mentions of using QuickTime for Java to do this but as
the API has changed this ability seems to have gradually disappeared and
depending on QTJ being present is less than ideal. I¹m hoping there¹s a more
modern technique that¹s much simpler and more reliably available.


The solution does only need to work on OS X though and since it¹s a nice to
have feature it wouldn¹t matter too much if in some cases it didn¹t work.

I have been using QT4J, which is no longer functional as of J2SE6. There was a JNI method posted to this list some time back, using NSImage and NSData (in Objective-C), IIRC.


You should also be able to convert a PICT file to a Java-readable format using AppleScript (run the command osascript via Runtime.exec). Look at the scripting dictionary for "Image Events" (10.3+, IIRC). You would want something like:

    tell app "Image Events"
        set img to open somePictFile
        save img as PNG in someOtherFile
        close img
    end tell

IIRC Image Events requires the paths to be HFS paths in string form (e.g. "MyMac:Users:me:Pictures:foo.png"). _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.