NSImageView not properly updating - help!

So I have an image view in my studio application which is pulling artwork from itunes and updating when the song changes.

I have an empty file in my project, artwork.pict.

The code to load the image is as follows:

on GetArtwork(imageNum)
	log "get artwork: " & imageNum
	try 
		tell image view "albumimagewell" of CurrentView to delete every image 
		--CurrentView is a reference to the tab view item containing the image view
	on error
		log "image delete failed"
	end try
	tell application "iTunes" to set rawImageData to data of artwork imageNum of current track as picture
	set the_path to path to resource "artwork.pict"
	
	set ImageFile to (open for access the_path write permission 1)
	write rawImageData starting at 0 to ImageFile as picture
	close access ImageFile
	
	set TheArtwork to (load image "artwork") 
	tell CurrentView
		set content of image view "albumimagewell" to TheArtwork 
	end tell
	log "arwork set"
end GetArtwork

So this code should delete any previous image, and load a new one. And it does that successfully.

The problem is this: anytime I resize the window of my application, one of two things will happen

  1. (less frequent) the quality of the image displayed will progressively degrade with each resize, as though you were looking at a more compressed, pixelated version of the same image.

  2. (more frequent) as soon as you begin to resize, the image displayed will revert to either the previous image that was displayed, or the first image that was displayed when the application started up. If I click on the image view, the image will change to the current image that should be displayed, but as soon as I resize the window it reverts again.

Am I doing something wrong in not properly releasing the old image? Is this a deficiency in my code or some bugginess in the behavior of NSImageView?

In Interface Builder I have the Image View set to scale proportionately, and have it set as enabled but not editable. (Side note - what does “Animates” do?). The size of the image view is fixed.

If I open “artwork.pict” from within the package contents of the build application while it’s running, the file does reflect the current artwork, so the problem seems to be with the image view.

Any help would be greatly appreciated!