# Converting NSImageRep to NSImage?



## whitesaint (Jan 20, 2004)

Hi everybody and thanks for reading my post.  I have an NSBitmapImageRep that I need to convert to an NSImage.  The reason for this is I have an NSTableView with NSImageCells, and the NSImageCells don't know how to draw NSImageReps!  NSImageCell can only draw NSImages.  I've search everywhere, and can find very little help, i tried NSImageReps very few NSData methods and nothing is working..  Someone Please help me!


----------



## anarchie (Jan 20, 2004)

Have you tried this?


```
NSImage * image = [[NSImage alloc] initWithSize:[imageRep size]];
[image addRepresentation: imageRep];
```


----------



## whitesaint (Jan 27, 2004)

!@#$!! Whoa I cant believe this worked, thank you sooo much for your help   I never knew an image could be allocated and initialized just by size and an image representation...  ::angel::


----------

