Skip navigation.
 
mlRe: Resizing an image inside a text view
FROM : Keith Blount
DATE : Mon Nov 29 21:10:26 2004

Many thanks to you and Ryan for taking the time to
answer. Your help has got me most of the way - the
image is now updated properly, and I'm using the
non-destructive method you suggest - thanks!

The only part I'm struggling on is this:

> Yes, it also uses the original size when copying the
> textView.
> This is because for these operations the data from
> the
> attachments fileWrapper is used.
> And these data are still not changed. Create a new
> fileWrapper
> with the scaled imageReps (not the scaled image!)
> and replace
> the attachment.
>


No matter what I try, I cannot figure this out. I
think my problem is that I'm not sure how to scale an
imageRep, and I can't find this info in the docs. I've
been trying this:

NSSize s = [image size];
   s.width *= 2;
   s.height *= 2;
   [image setSize:s];

   
   NSImage *newImage = [[NSImage alloc] initWithSize:s];
   NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
initWithData:[image TIFFRepresentation]];
   [rep setSize:s];
   [newImage addRepresentation:rep];
   [cell setImage:newImage];

...among many other things, but I just cannot get the
image to stay the same size after dragging and
dropping - I would have thought that this would change
the data, but it doesn't. I have tried creating a new
text attachment and putting the new image into that,
but it still doesn't work. My problem is that I don't
understand how to scale an imageRep, whether that is
destructive to an image, and how to create a new image
with that rep that also contains all the original
data, I guess. For instance, the docs say that the
TIFF fields ImageLength and ImageWidth set the size of
an imageRep, but I can't find anywhere how to
manipulate these fields...

Many thanks for the help so far, and to anybody with a
few pointers on how I could achieve this last part I
would be very grateful.

Thanks and all the best,
Keith



       
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com

Related mailsAuthorDate
mlResizing an image inside a text view Keith Blount Nov 29, 01:17
mlRe: Resizing an image inside a text view Keith Blount Nov 29, 16:01
mlRe: Resizing an image inside a text view heinrich.giesen Nov 29, 17:59
mlRe: Resizing an image inside a text view Ryan Stevens Nov 29, 18:23
mlRe: Resizing an image inside a text view Keith Blount Nov 29, 21:10