• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[CIImageAccumulator image]: getting the BMP representation destroys the image contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CIImageAccumulator image]: getting the BMP representation destroys the image contents


  • Subject: [CIImageAccumulator image]: getting the BMP representation destroys the image contents
  • From: Nick <email@hidden>
  • Date: Sat, 07 Feb 2015 01:23:38 +0200

Hello,
I am playing with the CIMicroPaint sample code (
https://developer.apple.com/library/mac/samplecode/CIMicroPaint). This is
basically a simple paint editor (you can draw on a view with a mouse using
CoreImage).

I would like to save whatever is drawn into a file. So what I do is call
this, when the save button is pressed:

-(IBAction)saveButton:(id)sender {

    NSBitmapImageRep *bir = [[NSBitmapImageRep alloc] initWithCIImage:self.
imageAccumulator.image];

    NSData *bmpData = [bir representationUsingType:NSBMPFileType properties:
nil]; //THIS LINE CORRUPTS THE CIImageAccumulator.image. WHY?

     [bmpData writeToFile:[@"~/test.bmp" stringByExpandingTildeInPath]
atomically:YES];

    //NSImage *img = [[NSImage alloc] initWithData:bmpData];

    //imageView.image = img;

}

This is the only code i added to the original Apple sample code.
The problem i have is that i can call representationUsingType only once to
get the bmpData that i can save to disk as an image.
If i draw something, and call it again later,  i will get the old image,
not the updated one. Also the commented imageView code shows the same
problem - the NSImageView gets updated only the first time, not the
subsequent times.

What can be the cause of this?
It really looks like a bug in Apple framework code. Or is it me doing
something wrong?

I have found similar problem/questions, but they hasn't been answered:

http://stackoverflow.com/questions/23009472/ciimage-converted-to-nsdata-or-nsimage-seems-to-lose-changes-made-to-the-ciimage

http://stackoverflow.com/questions/26075375/ciimage-obtained-from-ciimageaccumulator-after-converting-to-nsdata-is-corrupted

Thank you!
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: [CIImageAccumulator image]: getting the BMP representation destroys the image contents
      • From: Sandor Szatmari <email@hidden>
  • Prev by Date: Re: ARC dealloc best pratice
  • Next by Date: Re: ARC dealloc best pratice
  • Previous by thread: Re: Convert to NSString from
  • Next by thread: Re: [CIImageAccumulator image]: getting the BMP representation destroys the image contents
  • Index(es):
    • Date
    • Thread