/**
  * Gets the actual thumbnail image data of an image.
  *
  * @return Returns said image data or <code>null</code> is this image has no such image data.
  */
 public synchronized RenderedImage getThumbnailImage()
     throws BadImageFileException, ColorProfileException, IOException, UnknownImageTypeException {
   RenderedImage strongRef = m_thumbnailImageRef != null ? m_thumbnailImageRef.get() : null;
   if (strongRef == null) {
     final ImageType t = getImageType();
     strongRef = t.getThumbnailImage(this);
     if (strongRef != null) m_thumbnailImageRef = new WeakReference<RenderedImage>(strongRef);
   }
   return strongRef;
 }
 /**
  * Gets the actual image data of an image.
  *
  * @param thread The thread that will do the getting.
  * @param read2ndTIFFImage If <code>true</code> and the image file is a TIFF file and it has a
  *     second TIFF image, read it instead of the first image. If the file is not a TIFF file, this
  *     flag has no effect.
  * @return Returns said image data.
  */
 public synchronized PlanarImage getImage(ProgressThread thread, boolean read2ndTIFFImage)
     throws BadImageFileException, ColorProfileException, IOException, UnknownImageTypeException,
         UserCanceledException {
   PlanarImage strongRef = m_imageRef != null ? m_imageRef.get() : null;
   if (strongRef == null) {
     final ImageType t = getImageType();
     if (t instanceof TIFFImageType)
       strongRef = TIFFImageType.getImage(this, thread, read2ndTIFFImage);
     else strongRef = t.getImage(this, thread);
     if (strongRef != null) m_imageRef = new WeakReference<PlanarImage>(strongRef);
   }
   return strongRef;
 }
 /**
  * Determines the preliminary {@link ImageType} for this image based solely on the image file's
  * filename extension. Unfortunately, this may not be correct because of the special case of some
  * raw images being in files having a <code>.TIF</code> extension.
  *
  * <p>The reason that determining the {@link ImageType} has to be split into two parts is to
  * prevent an infinite loop during final {@link ImageType} determination that can use an image's
  * metadata that in turn needs to know the {@link ImageType} in order to read the metadata. (The
  * preliminary {@link ImageType} is good enough for reading metadata since all raw images in files
  * having a <code>.TIF</code> extension use TIFF metadata.)
  *
  * @throws UnknownImageTypeException if the image type could not be determined.
  * @see #determineFinalImageType()
  */
 private void determinePreliminaryImageType() throws UnknownImageTypeException {
   if (m_imageType == null) {
     m_imageType = ImageType.determineTypeByExtensionOf(m_imageFile);
     if (m_imageType == null) throw new UnknownImageTypeException(m_imageFile.getName());
   }
 }
 /**
  * Gets the actual preview image data of an image.
  *
  * @param maxWidth The maximum width of the image to get, rescaling if necessary. A value of 0
  *     means don't scale.
  * @param maxHeight The maximum height of the image to get, rescaling if necessary. A value of 0
  *     means don't scale.
  * @return Returns said image data or <code>null</code> is this image has no such image data.
  */
 public synchronized RenderedImage getPreviewImage(int maxWidth, int maxHeight)
     throws BadImageFileException, ColorProfileException, IOException, UnknownImageTypeException {
   RenderedImage strongRef = m_previewImageRef != null ? m_previewImageRef.get() : null;
   if (strongRef == null) {
     final ImageType t = getImageType();
     strongRef = t.getPreviewImage(this, maxWidth, maxHeight);
     if (strongRef != null) m_previewImageRef = new WeakReference<RenderedImage>(strongRef);
   }
   return strongRef;
 }