Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Best way to make Image Previews?

Best way to make Image Previews?
Thread Tools
Fresh-Faced Recruit
Join Date: Jul 2001
Status: Offline
Reply With Quote
Jul 20, 2001, 02:02 PM
 
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
Reply With Quote
Jul 23, 2001, 12:29 AM
 
Anyone??
     
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Jul 24, 2001, 04:08 AM
 
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.
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Jul 24, 2001, 02:14 PM
 
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)mouseUpNSEvent *).
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Jul 28, 2001, 11:39 AM
 
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
Reply With Quote
Jul 28, 2001, 05:29 PM
 
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*
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:43 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2