 |
 |
Best way to make Image Previews?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2001
Status:
Offline
|
|
I'm in the process of drawing up the specs for a new application. One feature of this application is the ability to display a relatively large (thinking about twice as big as a 35mm slide) preview of an image file that is stored on the user's HD. It would have to support all the major file types (PSD, TIFF, EPS, JPEG, GIF, PNG) as well.
I've been reading up on the various Classes and Subclasses that might help me to get this puppy working, but I'm not really up to full speed yet. I think NSImage could work based on its description in the ADC documentation, but I'm not sure.
I basically want to implement something similar to what Apple has done with the preview that is used in the Column View Finder. I don't want the user to be able to move or scale the image. Perhaps the only interactiviy would be a double-click to open the file in its parent editor, but that's about it.
Ideas?
[ 07-23-2001: Message edited by: NSNewbie ]
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2001
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status:
Offline
|
|
Originally posted by NSNewbie:
<STRONG>Anyone??</STRONG>
QuickTime's graphics importers will easily import all of those file formats and draw them in just a few lines of code.
I imagine that Cocoa has classes that can read at least some image formats, but it's been years since I did anything serious with OpenStep/Cocoa.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status:
Offline
|
|
NSImage and NSImageView will do everything for you with just a few lines of code. NSImage knows how to open most if not all of the major formats (initWithContentsOfFile  , and NSImageView will display an image at a desired size, with proportional scaling if you like (configure it in IB then use setImage: in your code). The only non-trivial part would be handling the double-click. To do this you'd probably subclass NSImageView and override -(void)mouseUp  NSEvent *).
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
Using NSImage is probably the easiest way, though it will only support TIFF, JPG, GIF, and PNG from that list (i.e. forget about EPS and PSD unless there's an image filter service installed on the computer).
I'm not sure what extra formats the Quicktime stuff supports, but it wouldn't surprise me if it was more.
You could find the Unix ImageMagick utilities; with the right libraries it will support all of those formats and more (EPS via the ghostscript stuff). I'm not sure if there's a way to get a library out of ImageMagick you can link to and use or if you'd have to just include its command-line program in the app wrapper and invoke it with NSTask to create a scaled .tiff preview that you can use to display.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by lindberg:
<STRONG>Using NSImage is probably the easiest way, though it will only support TIFF, JPG, GIF, and PNG from that list (i.e. forget about EPS and PSD unless there's an image filter service installed on the computer).
I'm not sure what extra formats the Quicktime stuff supports, but it wouldn't surprise me if it was more.</STRONG>
You could always write a nice Obj-C wrapper for the QuickTime image converter
<STRONG>You could find the Unix ImageMagick utilities; with the right libraries it will support all of those formats and more (EPS via the ghostscript stuff). I'm not sure if there's a way to get a library out of ImageMagick you can link to and use or if you'd have to just include its command-line program in the app wrapper and invoke it with NSTask to create a scaled .tiff preview that you can use to display.</STRONG>
*YUCK* *VOMIT*
*COUGH* hack *COUGH*
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|